-2

I want to click on login button. Which attribute should I use to click on login button? I am new to selenium web driver. I am unable to find its link text, id, class name, name. I am not able to find its XPath or CSS selector. please advice me with the code. Image is here

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Abhishek
  • 9
  • 3
  • Please read why [a screenshot of code is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Paste the code and properly format it instead. – JeffC Jun 02 '18 at 02:56

3 Answers3

0

To click on element with text as LOGIN within the url https://phptravels.com/404/ you can use either of the Locator Strategies:

  • CssSelector:

    "a.login[href='http://phptravels.org']>span"
    
  • XPath:

    "//a[@class='login' and @href='http://phptravels.org']/span[contains(.,'LOGIN')]"
    //or
    "//a[@class='login' and @href='http://phptravels.org']/span[contains(.,'Login')]"
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

You have multiple options, just avoid using xpath since its an overkill

li.user-login>a.login>span

or

a.login>span

or xpath

.//a[@class='login']/span[text()='Login']
nilesh
  • 14,131
  • 7
  • 65
  • 79
0

You can use either Xpath which is

.//*[@id='main-menu']/ul/li[8]/a

or CSS Selector which is

.login
Prany
  • 2,078
  • 2
  • 13
  • 31