I am using RobotFramework(new to it) to access https://auth0.github.io/device-flow-playground/
and then click the Get Started
button on this page.
My code:
open browser https://auth0.github.io/device-flow-playground/
click button xpath://*[@id="start-btn"]
But I am getting this error :
Button with locator 'xpath://*[@id="start-btn"]' not found.
Just can't seem to figure out what is wrong here when the xpath is given correctly. Any pointers please?
CodePudding user response:
I'm not familiar with RobotFramework, however looks like you are missing a delay.
You need to wait for the element you want to click to be visible first and only after that to click it.
So, your code could be something like this:
Open Browser https://auth0.github.io/device-flow-playground/
Wait Until Element Is Visible xpath://*[@id="start-btn"]
Click Element xpath://*[@id="start-btn"]
CodePudding user response:
The answer is
Open Browser https://auth0.github.io/device-flow-playground/
Wait Until Element Is Visible xpath://*[@id="start-btn"] 10s
Click Element xpath://*[@id="start-btn"]
You can increase the wait time as you needed.
And as well as if there is multiple elements of button cross check if you add as argument as needed below
Click Element xpath:(//*[@id="start-btn"])[1]
Argument can be changed as per your need.
CodePudding user response:
Click Button only works for button elements. What you're trying to click on is a div , so you need to use Click element instead:
Click Element xpath://*[@id="start-btn"]