2

HTML :

<label for="header-nav-toggle" class="header-nav__toggle">Menu</label>

On clicking the Menu in the webpage the user is displayed with the SignOut option.

How to write an XPath for this action ??

For the XPath

$x("//*[@id='root']/div/main/div/header/div/label")

in the chrome - Devtools-Console I got

[label.header-nav__toggle]
0: label.header-nav__toggle
length: 1
__proto__: Array(0)

Need to select the 0: value. Facing error like

org.openqa.selenium.WebDriverException: unknown error:
    Element <label for="header-nav-toggle" class="header-nav__toggle">...</label>
    is not clickable at point (1236, 52). Other element would receive the click:
    <div class="sc-ifAKCX cHaoWT" data-delay="250"></div>
hong4rc
  • 3,999
  • 4
  • 21
  • 40
  • Functionally, a ` – undetected Selenium Oct 13 '18 at 19:54

2 Answers2

0

You can refer this solution, based on given HTML and Exception type:

Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//label[@class='header-nav__toggle' and contains(text(),'Menu')]"))).click().perform();
Ishita Shah
  • 3,955
  • 2
  • 27
  • 51
0

Try adding waits before clicking the element.

Or use javascript to click the element.

More here: Debugging "Element is not clickable at point" error.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77