Issue
In Snapdeal when I hover to Sign In and click login , it is opening signup dialog box and when I try to login in and click google Sign in, it is not finding the element.
@When("The user click login using google")
public void the_user_click_login_using_google() {
Set<String> ids = driver.getWindowHandles();
Iterator<String> it = ids.iterator();
String parentId = it.next();
String childId = it.next();
driver.switchTo().window(childId);
l1=new LoginPojo();
btnClick(l1.getGoogleuserlogin());
@FindBy(xpath = "//*[@id='googleUserLogin')]")
private WebElement googleuserlogin;
public WebElement getGoogleuserlogin() {
return googleuserlogin;
}
Solution
That Element is in an iframe
. I tried below code(in Python) and it worked.
driver.implicitly_wait(10)
driver.get("https://www.snapdeal.com/")
time.sleep(10)
driver.switch_to.frame(0)
driver.find_element_by_id("googleUserLogin").click()
Answered By - pmadhu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.