The click on below + icon is not working properly

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

1 Like

Hi,

Can you please try some waits: wait for element clickable

1 Like

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.

1 Like

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)

1 Like

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: This keyword uses Javascript click as the last fallback which may not have the same effect as an actual click on an element. Note: We use WebUI.enhancedClick() when working with offscreen elements/objects and hard to click on element/objects as it is more robust than using WebUI.click()

Click on 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.

imports ...
WebUI.waitForPageLoad(60) //Waits 60 seconds or less
WebUI.waitForElementVisible(findTestObject('HelpButton'), 60, FailureHandling.OPTIONAL) //Waits 60 seconds or less
WebUI.enhancedClick(findTestObject('HelpButton'), FailureHandling.OPTIONAL)

1 Like

Did they ever fix that waitForElementClickable() method?

@kazurayam

No.

Possibly you had better try a solution by JavaScript rather than “WebUI.*” keywords.
Ask @support.squad