私は一日中、この質問に対する答えをstackoverflowで探していました。Selenium WebDriver を使用して iframe をクリックし、登録フォームのフィールドに入力しようとしています。Python 自体は「要素が見つかりません」というエラーを返すため、JavaScript を使用してフィールドにアクセスしようとしています。
新しいエラーは、「raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: u'document.getElementById(...) is null' ;」です。
私が間違っていることについて何かアドバイスはありますか?
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase):
return ''.join(random.choice(chars) for x in xrange(size))
# Create a new instance of the Firefox driver
driver = webdriver.Firefox()
driver.get("http://bostinno.streetwise.co")
driver.find_element_by_link_text("Sign-up").click()
WebDriverWait(driver, 30)
driver.execute_script("document.getElementById('User_firstName').click()")
type(id_generator())