51Testing软件测试论坛
标题:
selenium,登录网页时出现错误,账号密码没问题,跳出error
[打印本页]
作者:
测试积点老人
时间:
2022-2-28 11:44
标题:
selenium,登录网页时出现错误,账号密码没问题,跳出error
使用selenium登录网站时,账号密码输入后,网页弹出error,不知道什么问题?
import pandas as pd
from lxml import etree
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time
opt = Options()
opt.add_experimental_option('excludeSwitches', ['enable-automation'])
opt.add_argument("--referer=http://pss-system.cnipa.gov.cn/sipopublicsearch/portal/uiIndex.shtml")
opt.add_argument('user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"')
driver = webdriver.Chrome(executable_path='chromedriver', options=opt)
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument",{...})
driver.get('http://pss-system.cnipa.gov.cn/sipopublicsearch/portal/uilogin-forwardLogin.shtml')
driver.implicitly_wait(10)
username = "lovae0915"
password = "passwords"
driver.find_element(By.XPATH, '//*[@id="j_username"]').send_keys(username)
driver.find_element(By.XPATH, '//*[@id="j_password_show"]').send_keys(password)
time.sleep(30)
cookie = driver.get_cookies()
print(cookie)
driver.quit()
复制代码
运行结果及报错内容
[attach]136612[/attach]
[attach]136613[/attach]
想了解这是由于什么原因出现的问题,以及解决方式或解决思路
作者:
qqq911
时间:
2022-3-1 10:03
验证码的问题把
作者:
kallinr
时间:
2022-3-1 11:31
反爬
作者:
jingzizx
时间:
2022-3-1 14:55
值传输是否正常
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2