Ho un iframe che viene caricato quando faccio clic su una scheda in una pagina. Quando uso Firebug per guardare l'iframe su IE8, tutto quello che vedo è:Selenium e iframe
iframe id=tabContextFrame class=contextFrame contentEditable=inherit src=/xyz.dt?forward=show&layouttype=NoHeader&runid=1234 name=tabContextFrame url=/xyz.dt?forward=show&layouttype=NoHeader&runid=1234 scrolling=auto
e questo è it.The gerarchia di sotto del iframe non può essere visto. Voglio fare clic su un collegamento all'interno dell'iframe. Per trovare gli elementi all'interno dell'iframe, ho fatto un selenium.click("on the tab that loads the iframe")
e poi selenium.getHtmlSource()
. Da questa fonte, posso almeno individuare il mio link di interesse. Ho fatto un selenium.click("//span[text()='Link']")
ma non sembra fare nulla. Qualche idea per favore?
Ecco il codice:
selenium.click("//span[text()='tab that loads iframe']");
Thread.sleep(5000);
selenium.selectFrame("tabContextFrame");
selenium.mouseOver("//span[text()='Link']");
selenium.mouseDown("//span[text()='Link']");
selenium.mouseUp("//span[text()='Link']");
Thread.sleep(5000);
selenium.selectFrame("null");
Hai provato il selenio 2.0 con il driver web? U può usare driver.SwitchTo(). Frame() – Sudara
possibile duplicato di [gestione iframe nel webdriver] (http://stackoverflow.com/questions/9942928/handling-iframe-in-webdriver) – Innovation