I honestly wanted to find the solution on my own, but after more than twenty hours and hundreds of web pages (and a couple of Selenium books) I have to ask for your help.
The BIG problem: Web app working only in IE8. Firebug Lite not working with it for some reason.
What am I trying to accomplish and issues I encounter:
I have a page with a couple of frames. One of the frames contains a menu. I need to click one of the options to expand it and get access to the entries of the submenu and then I can click on the needed submenu entry. When all this is done, I can get access to different information in the frame on the right. I have tried finding the element by linkText, image id, xpath.
Here is the HTML code for the structure from the IE Developer Tools:
I am going through four pages to get here. As that code is not relevant I will not paste it. The code below shows how I am trying to get the correct Xpath.
List<WebElement> allXpathElem = driver.findElements(By.xpath("//frameset"));
System.out.println("XPath elements number: " + allXpathElem.size());
for(int i=0; i < allXpathElem.size(); i++)
System.out.println("XPath element " + (i+1) + ": " + allXpathElem.get(i));
After some fooling around:
driver.switchTo().frame(driver.findElement(By.xpath("//frameset/frame[1]")));
List<WebElement> nextStepElem = driver.findElements(By.xpath("//frameset/frame[1]/div"));
System.out.println("XPath elements number: " + nextStepElem.size());
for(int i=0; i < nextStepElem.size(); i++)
System.out.println("XPath element " + (i+1) + ": " + nextStepElem.get(i));
No matter what I type after /frame1 returns XPath elements number: 0. Would you be so kind to help me figure out how to find all the XPath elements under a certain entry? For example how do I find out all the elements that can go after the frame1/? ?
My ultimate goal is to go through the whole path so that I can click the submenu link (Client letters for example) and the corresponding content gets displayed in the right side frame. Do I have a better way of doing this than XPath?
Thank you!