1

I'm having major issue trying to select menu two elements on a dropdown.I've tried xpaths, link texts and css selector but it wont select either the password button or logout button.

Xpaths used for Password button: "//*[@id='app']/header/div[3]/nav/ul/li/a"

CSS used for Logout button: ["data-logged-in-log-out-button"] XPath used for Logout button: "//*[@id='app']/header/div[3]/nav/ul/a"

The error im getting for the select password is:

org.openqa.selenium.WebDriverException: unknown error: Element ... is not clickable at point (989, 233). Other element would receive the click: ...

Html and dropdown

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
user9686029
  • 252
  • 1
  • 2
  • 11
  • Please add the exact xpaths or other locators you used. – Shivam Mishra Jul 03 '18 at 10:54
  • What do you want to select - Log Out? What is the exception that you are getting? Can you please share your code that you tried? – eduPeeth Jul 03 '18 at 10:55
  • can you share this HTML code in text format. – cruisepandey Jul 03 '18 at 10:55
  • Ive added the Xpaths and selectors ive tried, im trying to select the password button and also the logout button. The error im getting for the select password is: org.openqa.selenium.WebDriverException: unknown error: Element ... is not clickable at point (989, 233). Other element would receive the click:
    ...
    – user9686029 Jul 03 '18 at 10:59
  • I see. Do you have some overlay (some translucent screen kinda) which appears when page loads? Looks like your locator is covered by some other element. – eduPeeth Jul 03 '18 at 11:01
  • The background should have the translucent cover but the "automation web" text above it is being recognised somehow so i dont understand how the other two arent being picked up – user9686029 Jul 03 '18 at 11:03
  • Could you please try the below code and let me know if you still get an error? – eduPeeth Jul 03 '18 at 11:09

2 Answers2

0

Can you please try -

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class A {

    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();
        driver.get("url here");
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Log Out")));
        driver.findElement(By.linkText("Log Out")).click();;
    }

}

If it still doesn't work, please try -

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class A {

    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();
        driver.get("url here");

        JavascriptExecutor js = (JavascriptExecutor) driver;
        js.executeScript("arguments[0].click();", driver.findElement(By.linkText("Log Out")));
    }

}
eduPeeth
  • 1,840
  • 13
  • 21
  • No its not picking it up, java.lang.NullPointerException, it doest seem to find the element at all – user9686029 Jul 03 '18 at 11:12
  • Then, mate you need to find out what is covering this element. From the given html code, it's not clear. Looks like `
    ...
    ` is covering it. Can you try inspecting it and see if get any thing?
    – eduPeeth Jul 03 '18 at 11:20
0

Please try with the below XPath along with the explicit wait condition.

XPath:

//*[contains(text(),'Log out')]
Subburaj
  • 2,294
  • 3
  • 20
  • 37