このPython/Seleniumスクリプトを実行するとこのエラーが発生します。ここでPython/SeleniumのElementNotVisibleExceptionエラー
File "./a.py", line 21, in <module>
elem = driver.find_element_by_id("licensees").click()
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message:
htmlコードはここ
<p>
<button onClick="myloginwindow1('')" value="Login Now" name="licensees" id="licensees">
<p>Licensee Login</p>
</button>
</p>
あるコードです。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("https://xxxxx.com")
assert "xxxxxxxx" in driver.title
try:
element = WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "licensees"))
)
elem = driver.find_element_by_id("licensees").click()
finally:
driver.quit()
私はエラーを取得しない
elem = driver.find_element_by_id("licensees").click()
を削除します。