Auto-learner
Auto-learner

Reputation: 1511

How to click hidden angular elements in Selenium2Library using Robot framework

I have a hyperlink on my webpage.It matches when I find element through Xpath. When I execute the same it says:

.//span[@translate='home.onboarding.name'] did not match any elements

I have tried the same using selenium webdriver and it executes. Please help me in converting the same syntax in Robot Framework using Selenium2library or any alternate option to find hidden elements. Please check screenshot in the next link for reference.Xpath and Inscpect element image for reference Any help would be appreciated. Thanks.

Selenium code example:

element = driver.find_element_by_xpath("//span[@translate='aside.nav.Operate.OnBoardDevices']")
driver.execute_script("$(arguments[0]).click();",element)

RF Code example:

Click Element   xpath = //span[text()='CAMBIUM'] 
Sleep   3
Click Element   xpath = //span[@translate='home.onboarding.name']

Upvotes: 0

Views: 1713

Answers (1)

jim
jim

Reputation: 906

You can use Wait Until Element Is Visible keyword to verify that element is indeed available for clicking.

However, as you have mentioned in the comments that your application uses AngularJS, I have to suggest that you switch from Selenium2Library to ExtendedSelenium2Library. It has native support for waiting for elements in Angular.

Upvotes: 1

Related Questions