javascript - 在编写 XPATH 时,我可以访问 #doucment..inside #document 我必须在下面的 html/body 中输入我的 ntml 页面
问题描述
和下面的我的xpath:(//span[text()='Information']//following::div[contains(@class,'edit-area')])[1]/iframe
bt 当我运行 mr 脚本时,它显示部分窗口中不存在 iframe。即使我尝试使用 WHEN 搜索框架,我也尝试获取显示 iframe 大小为 = 0 的框架大小
解决方案
WebElement frame =driver.findElement(By.xpath("(//span[text()='Information']//following::div[contains(@class,'edit-area')])[1]/iframe"));
System.out.println(frame);
driver.switchTo().frame(frame);
WebElement elem = driver.findElement(By.xpath("/html/body/p"));
System.out.println(elem);
Actions actions = new Actions(driver);
actions.moveToElement(elem);
actions.click();
actions.sendKeys("SOME DATA");
actions.build().perform();
System.out.println("finished");
推荐阅读
- solr - Delta 导入导致 Solr 响应翻倍甚至更差
- perl - Perl Redis 监听不订阅频道
- powershell - 如何使用 PowerShell 更改 Chrome 中的默认下载文件夹?
- c - 为什么这段代码开头需要分号
- apache-spark - Spark 依赖较少的模型导出如何工作?
- java - 从 jdk 8 迁移到 11,得到空字符串,之前是普通字符串
- angular - 创建组件实例并作为 [object HTMLelement] 传递给另一个组件
- regex - 如何在捕获组中捕获组?
- c++ - 如何在循环中增加和减少一系列数字
- python - 比较 django if 块中的两个 django 变量