2017-05-04 101 views
-1

enter image description here硒的HtmlUnit org.openqa.selenium.ElementNotVisibleException:您可能只對可見元素

互動問題上選擇單選按鈕,需要支持,與JavaScript 但不工作嘗試。

WebElement Select4 = driver.findElement(By.name("IsGoldMember")); 
Select4.click(); 
+0

請提供完整的,最少重複性的案例。 –

+0

硒不會與不可見的元素相互作用。它被設計爲按照用戶的意願與頁面進行交互。請嘗試單擊LABEL。你還試過了什麼? – JeffC

+0

嘗試'driver.findElement(By.cssSelectro(「div fieldset.form-cbox-group div> input#IsGoldMemberTrue」))。click();' – kushal

回答

0

嘗試driver.findElement(By.xpath("//input[@id='IsGoldMemberTrue']"));。這可能是名稱IsGoldMember在網頁上不唯一的情況。

+0

嘿它適用於下面的代碼,WebElement webElement = driver.findElement(By.id(「IsGoldMemberFalse」)); Actions actions = new Actions(driver); actions.click(webElement).build()。perform(); –

+0

應用程序上的Html設計不是標準格式,這是我創建的問題 –

相關問題