Kartoffel
Kartoffel

Reputation: 11

Can't get link locator of element

Absolute beginner here.

I want my script to click on the Team tab of this website http://www.robotframeworktutorial.com/front-office/

My code is the following:

Load TeamPage
     Click Link    css=#bs-example-navbar-collapse-1 > ul > li:nth-child(5) >a

I get the following error:

Link with locator 'css=#bs-example-navbar-collapse-1 > ul > li:nth-child(5) > a' not found.

I have tried to use xpath and just the element's text with no success. Any help is deeply appreciated.

Upvotes: 0

Views: 125

Answers (1)

Dev
Dev

Reputation: 2813

May be problem with the long CSS locator. You can use the simple xpath for navigating to the TEAMS tab. the xpath for the Teams tab is - //a[@href="#team"]

This worked for me -

open browser     ${URL}    Chrome       executable_path=${path}
click element       //a[@href="#team"]

output-

enter image description here

Upvotes: 1

Related Questions