Home > Back-end >  Login ajio.com by Google/Facebook account using selenium web driver in java
Login ajio.com by Google/Facebook account using selenium web driver in java

Time:10-08

I am new to selenium ad I can't able to login ajio coding using google or my facebook account i even tries windows handling concept but it is having single window id but new tab appears and i tries using some key concepts like(\t) &(t) also but still i cannot pass my mail id in google account tab not only that no others buttons working on that new page pls clear my doubt.. suggest idea to make it work new tab(which is not allowed to automate)Exception

Note: I'm using java with selenium 3.141.59 & Chrome version 93.0.4577.82

CodePudding user response:

Actually login window is opening in another tab so you need to switch focus to another window. following code is working for me.

Set<String> windowslist = driver.getWindowHandles();
String lastwindow = null;
for(String eachWindow : windowslist){
     lastwindow = eachWindow;
}
driver.switchTo().window(lastwindow);


wait.until(ExpectedConditions.visibilityOfElementLocated(emailBox));
driver.findElement(emailBox).sendKeys("[email protected]");
  • Related