<iframe class="cke_wysiwyg_frame cke_reset" frameborder="0" src="" style="width: 100%; height: 100%;" title="Rich Text Editor, scDescription_0" aria-describedby="cke_14" tabindex="0" allowtransparency="true">
如何进入这个iframe并写一些文字......请帮忙
答案 0 :(得分:0)
它最终对我有用......
WaitTool.waitForElementPresent(driver, By.xpath("//iframe[contains(@title,'Rich Text Editor, scDescription_0')]"), 10);
WebElement iframe = driver.findElement(By.xpath("//iframe[contains(@title,'Rich Text Editor, scDescription_0')]"));
driver.switchTo().frame(iframe);
WebElement itemdescription = driver
.findElement(By.xpath("//body[@class='cke_editable cke_editable_themed cke_contents_ltr']"));
itemdescription.sendKeys(description);
driver.switchTo().defaultContent();
return driver;
还有其他解决方案吗?
答案 1 :(得分:0)
基本上,我们可以使用3种方式切换框架中的元素。
By Index
By Name or Id
By Web Element