Unable to find the close button(image) for an paytm login window | Selenium Forum
M
Manjunath K S Posted on 16/03/2021

This is the code i wrote to read the text of paytm login window and close the login window

am unable to identify the close button of the login window (its showing as image instead of button)

can you please help in this

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "C:\\SeleniumLearning\\Browsers\\chromedriver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://paytm.com");
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(By.xpath("//div[@class='_3fM-']")).click();
List<WebElement> frames=driver.findElements(By.tagName("iframe"));
System.out.println("Total frames inside webpage is "+frames.size());
driver.switchTo().frame(0);
String text=driver.findElement(By.xpath("//div[@class='content']")).getText();
System.out.println(text);

// trying to close the login window 
driver.findElement(By.xpath("//*[@id='\"app\"]/div/div[1]/div[3]/div[2]/div/a/img'")).click();
driver.switchTo().defaultContent();

}


A
Ashish Thakur Replied on 17/03/2021

close button might be out of frame..


S
Sangeeta Bisht Replied on 27/03/2021

Thats right. I switch to parent frame and then try to close, its working


Related Posts