SimpleBrowserDotNet / SimpleBrowser

A flexible and intuitive web browser engine designed for automation tasks. Built on .NET Standard 2.1.
Other
362 stars 105 forks source link

Input click does not work #263

Closed ghost closed 2 months ago

ghost commented 2 years ago

Hi, I need advice trying to click on the button using SimpleBrowser but for some reason it doesn't work.

Source page https://soap2day.ac/

var homePageButton = browser.Find("input", FindBy.Id, "btn"); if (homePageButton.Exists) { homePageButton.Click(); }

Thanks a lot

img01

img02

kevingy commented 2 years ago

@ORRNY66 The text of the exception is telling you what the problem is: "The requested operation is not available on disabled elements." The button is disabled. You circled the Exists member of the homePageButton variable. If you look at the XElement member below it, the quick watch window shows 'disabled="true"'. If the button were displayed in a graphical browser, it would be "greyed out" and you would not be able to click it. That's why it's not working.

To get it to work, you can enable the button by changing the value of the disabled attribute before attempting to click the homePageButton. The code is something like:

homePageButton.XElement.SetAttributeValue("disabled", "false");

kevingy commented 2 months ago

No reply in 2.5 years. I'm going to assume this is resolved.