java - 无法单击 Dynamics CRM selenium java 中的功能区按钮
问题描述
我正在尝试单击 Dynamics crm 上的功能区按钮,但它无法以任何方式看到它
结果:没有这样的元素
这是我的代码(java-selenium)这个元素:
Actions act=new Actions(driver);
act.moveToElement(driver.findElement(By.id("jwl_bi_newcustomer|NoRelationship|Form|jwl.jwl_bi_newcustomer.Button1.Button")));
act.click();
act.build().perform();
这是我的html
解决方案
当您处理时,您首先需要在实际找出元素之前切换到它们。
您也可以使用 xpath 找到元素,
driver.findElement(By.XPath("*//li[contains(@id,'jwl_bi_newcustomer.Button1.Button')]"))
所以,尝试使用切换您所需的 iframe,
driver.switchTo().frame(driver.findElement(By.id("jwl_bi_newcustomer|NoRelationship|Form|jwl.jwl_bi_newcustomer.Button1.Button")));
然后尝试找到那个元素
Actions act=new Actions(driver);
act.moveToElement(driver.findElement(By.id("jwl_bi_newcustomer|NoRelationship|Form|jwl.jwl_bi_newcustomer.Button1.Button")));
act.click();
act.build().perform();
再来早点使用框架,
driver.switchTo().parentFrame();
driver.switchTo().defaultContent();
推荐阅读
- typescript - .d.ts 文件中的错误何时会影响消费者?
- javascript - 除非我更改脚本文件的顺序,否则我的代码不会运行
- tcl - 如何将整数传递给 vmd 中的 tcl 过程
- scala - 一次启动两个 Scala Finagle ListeningServers
- c++ - 如何从代码本身向 wxwidgets 中的文本控件插入字符?
- google-cloud-platform - 迁移到 Google Cloud 后在浏览器中显示 IP 而不是域
- python - 按图像形状夹紧:用 Numpy 数组中的不同规则替换 X、Y 坐标
- node.js - ValidationException:该表没有指定的索引:GameTitleIndex
- subscript - 如何修复 QBASIC 中的“下标超出范围”错误?
- excel - VBA循环数字的列和行