SimpleBrowserDotNet/SimpleBrowser

Input click does not work

ORRNY66 opened this issue · 2 comments

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

@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");

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