我需要对我的应用程序进行CFBundleversion转换,因此我尝试了iTunes iTunes Connect网站的刮擦,但无法获取内容。
我尝试过:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://appstoreconnect.apple.com/login")
elem = driver.find_element_by_xpath("//input[@id='account_name_text_field']")
我收到以下错误:
elenium.common.exceptions.NoSuchElementException:消息:无法 定位元素:// input [@ id ='account_name_text_field']
我认为该网站的结构不同... 我该怎么办?
答案 0 :(得分:0)
定位器没有问题:
driver.find_element_by_xpath("//input[@id='account_name_text_field']")
在iframe
中,您需要先进行切换,使用frame_to_be_available_and_switch_to_it
和visibility_of_element_located
,如下所示:
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