bnoyahr
2 years agoNew Contributor
Function to click on link using xpath
I am trying to write a simple function to click on a link using the xpath to the link. I am getting a runtime error on the browser.Page.FindElement - can you please point me in the right direction. ...
- 2 years ago
Can you try something like this (see Page Object),
function Example() { Browsers.Item(btEdge).Run("http://smartbear.com/"); var page = Sys.Browser(btEdge).Page("*"); page.FindElement("//a[.='Apply for a permit']").Click(); }
Change the URL; use either Find() or FindElement().
Note, I only suggested the record actions, so that you can see the script that TC generates - to see the XPath query.
- 2 years ago
Thank you very much. It works.