0
votes

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']
1
So what is your error exactly? "not visible" or "did not match"? Please show us the robot code as well. Thanksjim
Open Browser ${cnMaestro_URL} ${Browser_Chrome} Click Button Sign In Input Text name=email ${cloud_Username} Input Text name=password ${cloud_Password} Click Button Sign in Click Element id=accountDetails-Menu Click Element xpath = //span[text()='CAMBIUM'] Sleep 3 boldClick Element xpath = //span[@translate='home.onboarding.name'] Input Text name = claimdevice 42-89-56-67-B0-0C,D8:D8:5F:3B:57:0E Click Button Claim Devices Sleep 5 Choose Cancel On Next Confirmation Close BrowserAuto-learner
Jim xpath = //span[@translate='home.onboarding.name'] is the one which I am trying to click .This element is clickable through webdriver which I have mentioned in 1st commentAuto-learner
What is the actual error text?jim
@jim following is the error which I am getting ValueError: Element locator 'xpath = //span[@translate='home.onboarding.name']' did not match any elements. Can you please check the Xpath and inspect element image for reference in the 1st comment for more information .. Thank you very much for your answersAuto-learner

1 Answers

1
votes

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.