CefSharp doesn't submit the form

153 Views Asked by At

browserContainer.EvaluateScriptAsync("document.querySelector('input[id=auth-modal-email]').value='****@gmail.com';");
browserContainer.EvaluateScriptAsync("document.querySelector('input[id=auth-modal-current-password]').value='*****';");
browserContainer.EvaluateScriptAsync("document.querySelector('button[type=submit]').click();");

I've been trying to login a website. I can see that id and password are being filled when I run the application and show it on panel. I also tried on BBC iplayer to understand whether it is related to javascript or not however it was working fine on BBC iplayer login screen.

The website: https://www.cars.com

1

There are 1 best solutions below

5
On BEST ANSWER

The website uses custom html components. Some of the html elements within those custom components cannot be accessed directly. You first have to find the custom component and then work from there.

Here is code that works for the submit button in the login form (assuming the login form is visible):

document.querySelector('cars-auth-modal').shadowRoot.querySelector('ep-button').click();