簡體   English   中英

無法單擊 Dynamics CRM selenium java 中的功能區按鈕

[英]unable to click on ribbon button in 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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM