Python Selenium Javascript登录

2024-06-01 00:09:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用selenium和Python登录此网站:

https://itunesconnect.apple.com/login?targetUrl=~2FWebObjects~2FiTunesConnect.woa~2Fra~2Fng~2Fapp~2F719525810~2Faddons

不幸的是,代码源代码没有显示我需要发送登录信息的Id=apple_Id,但是当我检查页面时,我看到了它。在

所以页面源看起来像这样: PageSource

但是我需要的是检查窗口: InspectWindow

我想这是因为它的javascript呈现什么的,但我不知道怎么做!在

谢谢


Tags: 代码httpscom信息idapple源代码网站
1条回答
网友
1楼 · 发布于 2024-06-01 00:09:10

必需的input字段位于iframe内,因此为了能够处理它,您应该首先切换到iframe

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC


wait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, "aid-auth-widget-iFrame")))
driver.find_element_by_id("appleId").send_keys('text')

相关问题 更多 >