I need to click the + icon below the text “Add on”. Always On hovering “+” icon a tool tip is showing. I used this xpath //div[@class=‘mt-3’]//button[@class=‘addmore’]//img[@class=‘add_img’]. First time on running the script it worked. But next time it is not clicking. Instead on the displayed tool tip text initial part is showing as selected. Automation script is not failing it is shown as passed. But the click is not worked on further running script
On running script the first portion of tool tip text is highlighted. See the below image
It worked when I add Double click. But manually it will work for the first click. Also using Double click it worked only once then it is not working
Can you please try some waits: wait for element clickable
It looks like you have at least a couple of worthless “waitForElementVisible” statements that you can get rid of because you have the “timeOut” set to zero. Since it may take 0.1 seconds to ensure the element is visible on your page, that is more than you want to wait so either remove the line or use it like it should be, and set it to 10 like you have your first two.
Maybe target the actual button instead, instead of the image that the button contains?
That last part of your xpath appears to be a YAGNI (You Ain’t Gonna Need It)
That keyword doesn’t work as advertised.
Hi @archana0393, We use the following for our best practices when loading webpages and waiting for elements to render/display on a webpage:
Keywords to use when loading webpages and interacting with buttons and other webpage elements.
Waits for a page to load within the defined timeout.
Waits until the given web element is visible within the defined timeout, our preferred keyword.
Waits for the given element to be present within the defined timeout.
Clicks on the given element using various trial-and-error methods. Note:
HelpButton example test case:
Note: Wait timeouts may vary based on the demands put on your systems, for example our CICD Pipelines require a 60 second timeout due to many other requests being made.
WebUI.waitForPageLoad(60) //Waits 60 seconds or less
WebUI.waitForElementVisible(findTestObject('HelpButton'), 60, FailureHandling.OPTIONAL) //Waits 60 seconds or less
Did they ever fix that