I am not able to close the chat window in the below website. This chat window appears after 10 seconds of the website launch. Looks like this is an Iframe. i am looking to close this chat window before i proceed with other steps, script was failing if this window appears in between.
below is the code i tried and it is not working.
website : https://www.indianeagle.com
int iframeCount = driver.findElements(By.tagname("iframe")).size(); // this is giving count as 7
1. int iframeCount = driver.findElements(By.xpath("//iframe")).size(); //with this i am getting count as 9 - why is that difference in count.
2. when i go to page source and search with text iframe i see only 2 occurences.
i tried iterating from 0 to iframeCount - each time i am switching to new iframe with index number and searching for the particular element to make sure that is chat window i want to close.
but when the index count is 1 - execution is geting aborted saying iframe does not exist.
can you pls check and let me know how to handle this scenario.
InstructorDemo Reply on 12/03/2019
See, there are different possibilities for Xpaths. Make up your own Custom XPath, retrieve the element and then try again
i can create my xpaths but to work on that object i need to move to that iframe rt ? how do we do that in this case ?
InstructorDemo Reply on 14/03/2019
you can use the web element method instead of the index method to retrieve the frame
Thank you, this can be closed