mardi 1 novembre 2016

How to handle (X) button inside iframe using selenium

Hellow guys, please guide me to solve issue. I am able to access all fields inside the iframe which is in div, I want to close iframe but i am unable to access (X) button. The close button is outside iframe and inside here is my code.

To switch into iframe from main window BaseClassOne.driver.switchTo().frame(BaseClassOne.driver.findElement(By.xpath("//*[@id='Dealership quote Internal']/iframe")));

To access iframe element BaseClassOne.driver.findElement(By.xpath("//*@id='txtDealershipRef']")).sendKeys("XYZ090123");

I tried below mention code to close modal popup window.

BaseClassOne.driver.findElement(By.tagName("a")).click();// throwing no such element exception

BaseClassOne.driver.close();// this is closing browser instance

BaseClassOne.driver.switchTo().defaultContent(); // modal pop-up is not closing hence not able to access main window element

Please guide me. Thanks in advance.

enter image description here

Aucun commentaire:

Enregistrer un commentaire