Home > database >  Infinite loop with selenium implicit wait java
Infinite loop with selenium implicit wait java

Time:06-06

I'm testing the discord website, but when change the route, the test fail. I'm trying use implicit wait, but i'm getting a infinit loop. (using selenium 3.5.3)

System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
WebDriver navegador = new ChromeDriver();

navegador.get("https://discord.com/");
navegador.findElement(By.className("button-ZGMevK")).click();
navegador.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
navegador.findElement(By.name("email")).sendKeys("[email protected]");
navegador.findElement(By.name("password")).sendKeys("password");

CodePudding user response:

If you want to go to the login page, why not change your url directly to login?

Like this https://discord.com/login :

navegador.get("https://discord.com/login");
navegador.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
navegador.findElement(By.name("email")).sendKeys("[email protected]");
navegador.findElement(By.name("password")).sendKeys("password");

But if you still want to click the login button first, change this line :

navegador.findElement(By.className("button-ZGMevK")).click();

To be:

navegador.findElement(By.cssSelector("div.appButton-2_tWQ1 > a[href*=login]")).click();
  • Related