[英]selenium webdriver @findby anotation throws null pointer exception
使用jar- Selenium-server-standalone-2.35.0.jar和IEDriverServer64.exe
瀏覽器 - IE11
UI構建在AngularJS上
因此,當我使用@FindBy
注釋時,它會拋出空指針異常。
@FindBy(how= How.ID, id= "abc")
public WebElement abcdropdown;
如果我這樣使用,它似乎工作正常。
public By abcdropdown = By.id("abc");
所以我創建了一個類,其中我已經像這樣分配了所有id,然后在測試調用中使用它們,在這種情況下,所有id都在元素類中。
請告訴我這是什么問題。
當您使用頁面工廠時,您必須使用PageFactory.initElements(驅動程序,頁面對象),否則將拋出空指針異常。
確保使用PageFactory初始化元素。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.