Basic button detection question
Posted: Fri Oct 21, 2016 10:51 am
Hello all.
I was just trying some browser testing (in IE) when I found some buttons that I could not manage to detect with user code. Using XPath I can find all buttons perfectly fine.
The code I am using to try to detect them:
This will always return "No buttons found". I have also tried the div element that's the parent of the list I'm using but it is also not working.
Using just "//button" will return all buttons so I assume either my path is built wrong or I am using the wrong method to search in my browser?
Thanks in advance for your time
Jordy
I was just trying some browser testing (in IE) when I found some buttons that I could not manage to detect with user code. Using XPath I can find all buttons perfectly fine.
The code I am using to try to detect them:
public void removeLocations() { IList<Button> allButtons = Host.Local.Find<Button>("/dom[@domain='main url']//ul[#'listLocaties']//button"); foreach(Button button in allButtons) { Report.Info("Button found: " + button.Text); if(button.Text.Contains("Verwijder")) { Mouse.Click(button); Report.Info("Delete button was clicked."); } else { Report.Info("Button was found but did not contain delete option."); } } Report.Info("No buttons found"); //to make sure code executed the loop in case it returns nothing }I typed 'main URL' because I can't post links due to being registered recently.
This will always return "No buttons found". I have also tried the div element that's the parent of the list I'm using but it is also not working.
Using just "//button" will return all buttons so I assume either my path is built wrong or I am using the wrong method to search in my browser?
Thanks in advance for your time
Jordy