0

Click event is not working in MAC OS Safari 13.05 Selenium Using java (No error message). Same Code works fine in other browser.

Code attempt:

public class CMSMlogin_Safari {

    public static void main(String[] args) {    
        WebDriver driver = new SafariDriver();
        //driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        driver.manage().window().maximize();
        driver.get("https://letskodeit.teachable.com"); 
        driver.findElement(By.xpath("//A[@class='navbar-link fedora-navbar-link'][text()='\n" + 
                "          Login\n" + 
                "        ']\n")).click();   
        }
}
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

To locate/click on an element you have to induce WebDriverWait for the elementToBeClickable and you can use either of the following Locator Strategy:

  • xpath:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@class='navbar-link fedora-navbar-link' and contains(., 'Login')]"))).sendKeys("public");
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352