定位元素硒webdriver的,我試圖找到,然後用這個代碼
driver.findElement(By.name("X")).clear();
或
driver.findElement(By.cssSelector("input[name=X][type=text]")).clear();
清除textbox元素給定圖像中但他們都沒有工作,給出錯誤信息:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"name","selector":"X"}
和
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"input[name=X][type=text]"}
我在做什麼錯誤,以及如何解決這個問題?任何幫助表示讚賞,在此先感謝。
請提供您正在處理的頁面。 –