I used Record Web to create objects for my web UI product. I have a check box that appears to be properly created with tag/id/label and xpath. The xpath is relative //*[@id=“select-all”]. When I use Spy Web and capture the object and then use the Verify and Highlight button I get the message Found 1 element using XPath Selector. The problem is when I run the test, the item step passes (it clicks or checks) the element but the check box isn’t actually checked. I have used the inspector in chrome to try to find a better xpath but no luck so far. I can use the Verify Element Checked or Not Checked and it works properly. I must be close. Any advice?
I have the same problem.
hey buddies, don’t know if it’s late but I had the same problem and I solved it with this:
WebUI.sendKeys(findTestObject('Customer/Customer SignUp Page/acceptTermsCheck'), Keys.chord(Keys.SPACE))
The issue is still present in the latest version (5.10.1)
There is one huge difference when comparing manual steps carried out by a human to automation steps carried out by code. Speed.
Are you absolutely certain that your test has waited until the elements are ready to be automated?
If you have made very effort to ensure the elements are ready, then follow this advice and provide us with more information:
You can verify this very quickly by putting a Thread.sleep(5000) (or WebUI.delay(5000)) just before the line of code where you’re trying to click the checkbox. If it successfully clicks the checkbox after the delay, then Russ is correct, you need to properly wait for the DOM to be ready with a custom wait condition (do not use the sleep or delay from above, these were just to triage the issue).
If the checkbox still doesn’t get checked, then it’s likely due to a disagreement between your test code and the HTML of the page, in which case we need more information from you.
It’s 2021 and this issue still exists, some of the CheckBoxes it checks and some it doesn’t. I have tried a lot of different things, such as using different locators, scrolling to the element, delaying for 5 seconds. nothing works
Have you investigated if the checkboxes have the same id but are unique based upon another attribute, like value (such as True and False)? For these, you need to have the combo of attributes to uniquely identify them. I have also found I have to put wait statements or delays in my TCs until the element is “ready”.
Also, do you use,
WebUI.verifyElementChecked(findTestObject('TO')) after setting the check on the element?
Yes, I have tried to use attributes as well as CSS locators, and also this Checkbox is the only one in that block, and every time when I click “Verify and Highlight” it clearly hightlights this box and nothing else. And I do use
WebUI.verifyElementChecked(findTestObject('TO')), after my checkbox and that’s where test fails.
How about showing some HTML and this part of your script if you are able?
Thank you for your time and help, I really appreciate it. I used:
WebUI.sendKeys(findTestObject(‘Customer/Customer SignUp Page/acceptTermsCheck’), Keys.chord(Keys.SPACE))
and it seems to work. So, I don’t think there was an issue with my locators or DOM, no idea what the issue is, but I am using this workaround for now. Thanks again
Since you only have the one key, you might get away with just using:
WebUI.sendKeys(findTestObject('Customer/Customer SignUp Page/acceptTermsCheck'), Keys.SPACE)