Python 如何找到iTunes Connect网站上用于抓取的元素?

Python 如何找到iTunes Connect网站上用于抓取的元素?,python,selenium,scrapy,web-crawler,Python,Selenium,Scrapy,Web Crawler,我需要对我的应用程序进行CbundLeversion,所以我尝试了scrapy iTunes Connect网站,但无法获取元素 我试过: 从selenium导入webdriver driver=webdriver.Firefox() 驱动程序。获取(“https://appstoreconnect.apple.com/login") elem=driver。通过xpath(//input[@id='account\u name\u text\u field'])查找元素 我收到以下错误: e

我需要对我的应用程序进行CbundLeversion,所以我尝试了scrapy iTunes Connect网站,但无法获取元素

我试过:

从selenium导入webdriver
driver=webdriver.Firefox()
驱动程序。获取(“https://appstoreconnect.apple.com/login")
elem=driver。通过xpath(//input[@id='account\u name\u text\u field'])查找元素
我收到以下错误:

elenium.common.exceptions.NoTouchElementException:消息:无法 定位元素://input[@id='account\u name\u text\u field']

我认为网站是不同的结构。。。
我该怎么办?

您的定位器没有问题:

driver.find_element_by_xpath("//input[@id='account_name_text_field']")
iframe
中,您需要首先切换,使用
frame\u切换到可用,然后使用
switch\u切换到位于
的元素的
visibility\u,如下所示:

driver.get('https://appstoreconnect.apple.com/login')

WebDriverWait(driver, 30).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.ID, "aid-auth-widget-iFrame")))
WebDriverWait(driver, 30).until(expected_conditions.visibility_of_element_located((By.XPATH, "//input[@id='account_name_text_field']")))
elem = driver.find_element_by_xpath("//input[@id='account_name_text_field']")
elem.send_keys("userName")
以下内容:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions

您得到了什么错误?selenium.common.exceptions.NoSuchElementException:Message:找不到element://input[@id='account\u name\u text\u field']@ItamarMushkin driver.page\u源与浏览器视图源不同我不知道为什么不同的结果请编辑到问题体中,而不仅仅是在注释中