Python 显示隐藏的web表
我正试图擦桌子,但似乎看不见 在您以浅紫色展开“代码历史记录”部分后,此表位于此位置。登录凭据如下所示,但也很容易从试用帐户获得:Python 显示隐藏的web表,python,html,selenium,Python,Html,Selenium,我正试图擦桌子,但似乎看不见 在您以浅紫色展开“代码历史记录”部分后,此表位于此位置。登录凭据如下所示,但也很容易从试用帐户获得: 用户名=jd@mailinator.com 密码=m%$)-Y95*^.1英寸+ 下面是我试图获取的数据的图示。我对最下面一行感兴趣: 以下是我使用的代码: from selenium import webdriver driver_path = "path to chromedriver.exe" url_login = "https://www.finda
- 用户名=jd@mailinator.com
- 密码=m%$)-Y95*^.1英寸+
from selenium import webdriver
driver_path = "path to chromedriver.exe"
url_login = "https://www.findacode.com/signin.html"
url_code = "https://www.findacode.com/code.php?set=CPT&c="
username = 'jd@mailinator.com'
password = 'm%$)-Y95*^.1Gin+'
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(executable_path=driver_path, chrome_options=options)
driver.get(url_login)
form = driver.find_element_by_name('login')
form.find_element_by_name('id').send_keys(username)
form.find_element_by_name('password').send_keys(password)
form.find_element_by_xpath("//input[@value='Sign In']").submit()
driver.get(url_code+'0001U')
driver.find_element_by_id('history').click()
此时,当我查看
driver.page\u source
时,我希望表中的元素是可见的,但事实并非如此。我的想法中的缺陷在哪里?此站点在需要时加载页面片段(也称为延迟加载)。因此,当页面的该部分展开时,将加载实际内容。这有助于在“试用期”到期时,服务器可以返回通用内容,以防止未经授权的访问
我可以找到3种补救方法:
#历史记录之后可用。单击()
,然后加载内容div(在之后)。sectionbody
div不为空).get(“https://www.findacode.com/logs/codepage_stats.php?section=sh_history_div&set=CPT&c=0001U“”
感谢试图屏蔽密码的用户,但我打算共享密码,因为该帐户是为测试而创建的,登录凭据是查看问题所必需的。谢谢。我将从选项3开始尝试这些方法,看看效果如何。