Open Oraer opened 1 year ago
- 首先,你需要检查配置的网址是否有 “/” 后缀,如果有,请删除;
- 其次,推荐使用没有CloudFlare Bot检测的网址,比如 https://www.cordc.xyz ,我这边是生效的,目前绕过CloudFalre的检测有一定概率失败
谢谢,我已将网址为 https://www.cordc.xyz
但是新的问题又来了,
问题描述:
Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]"}
(Session info: chrome=115.0.5790.0);
同时,我通过审查 https://www.cordc.xyz 网页, 发现<上次签到时间>元素的Xpath的确是如此,您所给xpath是正确的
/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]
感觉这一行并不影响后续,所以我想注释这一行, 而当我将这一行注释掉的时候
# text = driver.find_element(by=By.XPATH,
# value="/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]").text
# print(text)
签到发生错误:
Expecting value: line 1 column 1 (char 0)
完整报错如下:
Run export DISPLAY=:99
[1]+ 1814 Running sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
google chrome version: 1[15](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:16).0.5790.110
major version is 115
{'timestamp': '2023-08-03T15:08:18.092Z', 'channels': {'Stable': {'channel': 'Stable', 'version': '115.0.5790.170', 'revision': '1148114', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chromedriver-win64.zip'}]}}, 'Beta': {'channel': 'Beta', 'version': '1[16](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:17).0.5845.62', 'revision': '1160321', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chromedriver-win64.zip'}]}}, 'Dev': {'channel': 'Dev', 'version': '1[17](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:18).0.5911.2', 'revision': '1175078', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win64/chromedriver-win64.zip'}]}}, 'Canary': {'channel': 'Canary', 'version': '117.0.5926.0', 'revision': '1178349', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win64/chromedriver-win64.zip'}]}}}}
download chrome driver successfully.
unzip chromedriver to ./chromedriver/chromedriver-linux64/chromedriver
/home/runner/.local/share/undetected_chromedriver
Login success!
Expecting value: line 1 column 1 (char 0)
- 首先,你需要检查配置的网址是否有 “/” 后缀,如果有,请删除;
- 其次,推荐使用没有CloudFlare Bot检测的网址,比如 https://www.cordc.xyz ,我这边是生效的,目前绕过CloudFalre的检测有一定概率失败
谢谢,我已将网址为 https://www.cordc.xyz
但是新的问题又来了,
问题描述:
Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]"} (Session info: chrome=115.0.5790.0);
同时,我通过审查 https://www.cordc.xyz 网页, 发现<上次签到时间>元素的Xpath的确是如此,您所给xpath是正确的
/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]
感觉这一行并不影响后续,所以我想注释这一行, 而当我将这一行注释掉的时候
# text = driver.find_element(by=By.XPATH, # value="/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]").text # print(text)
签到发生错误:
Expecting value: line 1 column 1 (char 0)
完整报错如下:
Run export DISPLAY=:99 [1]+ 1814 Running sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & google chrome version: 1[15](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:16).0.5790.110 major version is 115 {'timestamp': '2023-08-03T15:08:18.092Z', 'channels': {'Stable': {'channel': 'Stable', 'version': '115.0.5790.170', 'revision': '1148114', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chromedriver-win64.zip'}]}}, 'Beta': {'channel': 'Beta', 'version': '1[16](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:17).0.5845.62', 'revision': '1160321', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chromedriver-win64.zip'}]}}, 'Dev': {'channel': 'Dev', 'version': '1[17](https://github.com/Oraer/cordcloud_checkin/actions/runs/5752706760/job/15594293829#step:7:18).0.5911.2', 'revision': '1175078', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5911.2/win64/chromedriver-win64.zip'}]}}, 'Canary': {'channel': 'Canary', 'version': '117.0.5926.0', 'revision': '1178349', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5926.0/win64/chromedriver-win64.zip'}]}}}} download chrome driver successfully. unzip chromedriver to ./chromedriver/chromedriver-linux64/chromedriver /home/runner/.local/share/undetected_chromedriver Login success! Expecting value: line 1 column 1 (char 0)
十分奇怪,看着貌似是json数据的解析问题,综合上面无法找到xpath,我推测是登录没有成功,所以没有获取到正确的cookie,签到的post失败了。
我已经在codespace中构建了类似的环境, 但是还是遇到了另外的问题
@Oraer ➜ /workspaces/cordcloud_checkin (main) $ python AutoCheckin.py --username=$USERNAME --password=$PASSWORD --url=$URL --pushplustoken=$PUSHPLUSTOKEN
google chrome version: 115.0.5790.170
major version is 115
download chrome driver successfully.
unzip chromedriver to ./chromedriver/chromedriver-linux64/chromedriver
/home/codespace/.local/share/undetected_chromedriver
Traceback (most recent call last):
File "/workspaces/cordcloud_checkin/AutoCheckin.py", line 219, in <module>
main()
File "/workspaces/cordcloud_checkin/AutoCheckin.py", line 212, in main
result_massgae = start_checkin(username, password, url, chrome_path, chromedriver_path)
File "/workspaces/cordcloud_checkin/AutoCheckin.py", line 140, in start_checkin
driver = uc.Chrome(options=options, driver_executable_path=chromedriver_path)
File "/home/codespace/.local/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 409, in __init__
super(Chrome, self).__init__(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
请fork最新的版本,然后运行test action,查看打印的debug信息是否进入了正常的流程
正确获取了登录网页
Run export DISPLAY=:99
[1]+ 1792 Running sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
google chrome version: 115.0.5790.110
major version is 115
{'timestamp': '2023-08-05T[13](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:14):08:19.381Z', 'channels': {'Stable': {'channel': 'Stable', 'version': '115.0.5790.170', 'revision': '1[14](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:15)8114', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/1[15](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:16).0.5790.170/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/win64/chromedriver-win64.zip'}]}}, 'Beta': {'channel': 'Beta', 'version': '1[16](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:17).0.5845.62', 'revision': '1160321', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.62/win64/chromedriver-win64.zip'}]}}, 'Dev': {'channel': 'Dev', 'version': '117.0.5927.0', 'revision': '1178629', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5927.0/win64/chromedriver-win64.zip'}]}}, 'Canary': {'channel': 'Canary', 'version': '117.0.5931.0', 'revision': '1179742', 'downloads': {'chrome': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/linux64/chrome-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/mac-arm64/chrome-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/mac-x64/chrome-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/win32/chrome-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/win64/chrome-win64.zip'}], 'chromedriver': [{'platform': 'linux64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/linux64/chromedriver-linux64.zip'}, {'platform': 'mac-arm64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/mac-arm64/chromedriver-mac-arm64.zip'}, {'platform': 'mac-x64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/mac-x64/chromedriver-mac-x64.zip'}, {'platform': 'win32', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/win32/chromedriver-win32.zip'}, {'platform': 'win64', 'url': 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5931.0/win64/chromedriver-win64.zip'}]}}}}
download chrome driver successfully.
unzip chromedriver to ./chromedriver/chromedriver-linux64/chromedriver
browser_executable_path: None
driver_executable_path: ./chromedriver/chromedriver-linux64/chromedriver
get page url: f***/auth/login
page sources: f<html lang="zh-cn" class=" no-touchevents"><head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
<meta name="theme-color" content="#4285f4">
<title>CordCloud</title>
<!-- css -->
<link href="/theme/material/css/base.min.css" rel="stylesheet">
<link href="/theme/material/css/project.min.css" rel="stylesheet">
<link href="/theme/material/css/auth.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
<style>
.divcss5 {
position: fixed;
bottom: 0;
}
</style>
<!-- js -->
<script src="/assets/js/fuck.min.js"></script>
<script src="https://client.crisp.chat/l.js" async=""></script><link href="https://client.relay.crisp.chat" rel="dns-prefetch" crossorigin=""><link href="https://client.crisp.chat" rel="preconnect" crossorigin=""><script src="https://client.crisp.chat/static/javascripts/client.js?8124f72" type="text/javascript" async=""></script><link href="https://client.crisp.chat/static/stylesheets/client_default.css?8124f72" type="text/css" rel="stylesheet"><script type="text/javascript" async="" src="https://client.crisp.chat/settings/website/f24e0785-07d5-4a5f-961b-bde1c9b6245b/prelude/?callback=window.%24__CRISP_INSTANCE.__spool.website_handler&2023-7-6-6-52"></script></head>
<body class="page-brand">
<div class="authpage">
<div class="container">
<form action="javascript:void(0);" method="POST">
<div class="auth-main auth-row auth-col-one">
<div class="auth-top auth-row">
<a class="boardtop-left" href="/">
<div>首 页</div>
</a>
<div class="auth-logo">
<img src="/images/uim-logo-round.png">
</div>
<a href="/auth/register" class="boardtop-right">
<div>注 册</div>
</a>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login">
<label class="floating-label" for="email">邮箱</label>
<input class="form-control maxwidth-auth" id="email" type="email" name="Email" inputmode="email" autocomplete="username">
</div>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login">
<label class="floating-label" for="passwd">密码</label>
<input class="form-control maxwidth-auth" id="passwd" type="password" name="Password" autocomplete="current-password">
</div>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login">
<label class="floating-label" for="code">两步验证码(未设置请忽略)</label>
<input class="form-control maxwidth-auth" id="code" type="number" name="Code" inputmode="numeric" autocomplete="one-time-code">
</div>
</div>
<div class="btn-auth auth-row">
<button id="login" type="submit" class="btn btn-block btn-brand waves-attach waves-light waves-effect">
确认登录
</button>
</div>
<div class="auth-help auth-row">
<div class="auth-help-table auth-row">
<div class="checkbox checkbox-adv">
<label for="remember_me">
<input class="access-hide" value="week" id="remember_me" name="remember_me" type="checkbox">记住我
<span class="checkbox-circle"></span>
<span class="checkbox-circle-check"></span>
<span class="checkbox-circle-icon icon">done</span>
</label>
</div>
<a href="/password/reset">忘记密码?</a>
</div>
</div>
</div>
</form>
</div>
</div>
<div aria-hidden="true" class="modal modal-va-middle fade" id="result" role="dialog" tabindex="-1">
<div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-inner">
<p class="h5 margin-top-sm text-black-hint" id="msg"></p>
</div>
<div class="modal-footer">
<p class="text-right">
<button class="btn btn-flat btn-brand-accent waves-attach waves-effect" data-dismiss="modal" type="button" id="result_ok">知道了
</button>
</p>
</div>
</div>
</div>
</div>
<footer class="ui-footer">
<div class="container">
©2023 CordCloud | Powered by <a href="/staff">SSPANEL</a>
</div>
</footer>
<!-- js -->
<script src="/js/jquery.js"></script>
<script src="/theme/material/js/base.min.js"></script>
<script src="/theme/material/js/project.min.js"></script>
<script type="text/javascript"> window.$crisp = [];
window.CRISP_WEBSITE_ID = "f24e0785-07d5-4a5f-961b-bde1c9b6245b";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
$crisp.push(["safe", true])
$crisp.push(["set","user:nickname", ""],
["set","user:email",""],
["set", "session:data",
[[
["user_id",""],
["user_class",""],
["reg_email",""],
["last_use_time","从未使用喵"],
["expire_in",""],
["class_expire_time",""],
["available_traffic","0B"],
["balance",""]
]]
]);
</script>
<script>
let calltgbtn = document.querySelector('#calltgauth');
let tgboard = document.querySelector('.card.auth-tg.cust-model');
if (calltgbtn && tgboard) {
custModal(calltgbtn, tgboard);
}
</script>
<script>
$(document).ready(function () {
function login() {
document.getElementById("login").disabled = true;
$.ajax({
type: "POST",
url: location.pathname,
dataType: "json",
data: {
code: $$getValue('code'),
email: $$getValue('email'),
passwd: $$getValue('passwd'),
remember_me: $("#remember_me:checked").val()
},
success: (data) => {
if (data.ret == 1) {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
window.setTimeout("location.href='/user'", 500);
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
document.getElementById("login").disabled = false;
}
},
error: (jqXHR) => {
$("#msg-error").hide(10);
$("#msg-error").show(100);
$$.getElementById('msg').innerHTML = `发生错误:${
jqXHR.status
}`;
document.getElementById("login").disabled = false;
}
});
}
$("html").keydown(function (event) {
if (event.keyCode == 13) {
login();
}
});
$("#login").click(function () {
login();
});
$('div.modal').on('shown.bs.modal', function () {
$("div.gt_slider_knob").hide();
});
$('div.modal').on('hidden.bs.modal', function () {
$("div.gt_slider_knob").show();
});
})
</script>
</body></html>
get page url: f***/auth/login
page sources: f<html lang="zh-cn" class=" no-touchevents"><head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
<meta name="theme-color" content="#4285f4">
<title>CordCloud</title>
<!-- css -->
<link href="/theme/material/css/base.min.css" rel="stylesheet">
<link href="/theme/material/css/project.min.css" rel="stylesheet">
<link href="/theme/material/css/auth.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
<style>
.divcss5 {
position: fixed;
bottom: 0;
}
</style>
<!-- js -->
<script src="/assets/js/fuck.min.js"></script>
<script src="https://client.crisp.chat/l.js" async=""></script><link href="https://client.relay.crisp.chat" rel="dns-prefetch" crossorigin=""><link href="https://client.crisp.chat" rel="preconnect" crossorigin=""><script src="https://client.crisp.chat/static/javascripts/client.js?8124f72" type="text/javascript" async=""></script><link href="https://client.crisp.chat/static/stylesheets/client_default.css?8124f72" type="text/css" rel="stylesheet"><script type="text/javascript" async="" src="https://client.crisp.chat/settings/website/f24e0785-07d5-4a5f-961b-bde1c9b6245b/prelude/?callback=window.%24__CRISP_INSTANCE.__spool.website_handler&2023-7-6-6-52"></script></head>
<body class="page-brand">
<div class="authpage">
<div class="container">
<form action="javascript:void(0);" method="POST">
<div class="auth-main auth-row auth-col-one">
<div class="auth-top auth-row">
<a class="boardtop-left" href="/">
<div>首 页</div>
</a>
<div class="auth-logo">
<img src="/images/uim-logo-round.png">
</div>
<a href="/auth/register" class="boardtop-right">
<div>注 册</div>
</a>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login control-highlight">
<label class="floating-label" for="email">邮箱</label>
<input class="form-control maxwidth-auth" id="email" type="email" name="Email" inputmode="email" autocomplete="username">
</div>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login control-highlight">
<label class="floating-label" for="passwd">密码</label>
<input class="form-control maxwidth-auth" id="passwd" type="password" name="Password" autocomplete="current-password">
</div>
</div>
<div class="auth-row">
<div class="form-group-label auth-row row-login">
<label class="floating-label" for="code">两步验证码(未设置请忽略)</label>
<input class="form-control maxwidth-auth" id="code" type="number" name="Code" inputmode="numeric" autocomplete="one-time-code">
</div>
</div>
<div class="btn-auth auth-row">
<button id="login" type="submit" class="btn btn-block btn-brand waves-attach waves-light waves-effect" disabled="">
确认登录
<div class="waves-wrap"><div class="waves-ripple" data-hold="1691304725130" data-x="[17](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:18)1.953125" data-y="20" data-scale="scale(10.379999999999999)" data-translate="translate(0,0)" style="top:20px;left:171.953125px;-webkit-transform:scale(10.379999999999999) translate(0,0);-moz-transform:scale(10.379999999999999) translate(0,0);-ms-transform:scale(10.379999999999999) translate(0,0);-o-transform:scale(10.379999999999999) translate(0,0);transform:scale(10.379999999999999) translate(0,0);opacity:1;-webkit-transition-duration:600ms;-moz-transition-duration:600ms;-o-transition-duration:600ms;transition-duration:600ms;"></div></div></button>
</div>
<div class="auth-help auth-row">
<div class="auth-help-table auth-row">
<div class="checkbox checkbox-adv">
<label for="remember_me">
<input class="access-hide" value="week" id="remember_me" name="remember_me" type="checkbox">记住我
<span class="checkbox-circle"></span>
<span class="checkbox-circle-check"></span>
<span class="checkbox-circle-icon icon">done</span>
</label>
</div>
<a href="/password/reset">忘记密码?</a>
</div>
</div>
</div>
</form>
</div>
</div>
<div aria-hidden="true" class="modal modal-va-middle fade" id="result" role="dialog" tabindex="-1">
<div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-inner">
<p class="h5 margin-top-sm text-black-hint" id="msg"></p>
</div>
<div class="modal-footer">
<p class="text-right">
<button class="btn btn-flat btn-brand-accent waves-attach waves-effect" data-dismiss="modal" type="button" id="result_ok">知道了
</button>
</p>
</div>
</div>
</div>
</div>
<footer class="ui-footer">
<div class="container">
©2023 CordCloud | Powered by <a href="/staff">SSPANEL</a>
</div>
</footer>
<!-- js -->
<script src="/js/jquery.js"></script>
<script src="/theme/material/js/base.min.js"></script>
<script src="/theme/material/js/project.min.js"></script>
<script type="text/javascript"> window.$crisp = [];
window.CRISP_WEBSITE_ID = "f24e0785-07d5-4a5f-961b-bde1c9b6245b";
(function () {
d = document;
s = d.createElement("script");
s.src = "https://client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
$crisp.push(["safe", true])
$crisp.push(["set","user:nickname", ""],
["set","user:email",""],
["set", "session:data",
[[
["user_id",""],
["user_class",""],
["reg_email",""],
["last_use_time","从未使用喵"],
["expire_in",""],
["class_expire_time",""],
["available_traffic","0B"],
["balance",""]
]]
]);
</script>
<script>
let calltgbtn = document.querySelector('#calltgauth');
let tgboard = document.querySelector('.card.auth-tg.cust-model');
if (calltgbtn && tgboard) {
custModal(calltgbtn, tgboard);
}
</script>
<script>
$(document).ready(function () {
function login() {
document.getElementById("login").disabled = true;
$.ajax({
type: "POST",
url: location.pathname,
dataType: "json",
data: {
code: $$getValue('code'),
email: $$getValue('email'),
passwd: $$getValue('passwd'),
remember_me: $("#remember_me:checked").val()
},
success: (data) => {
if (data.ret == 1) {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
window.setTimeout("location.href='/user'", 500);
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
document.getElementById("login").disabled = false;
}
},
error: (jqXHR) => {
$("#msg-error").hide(10);
$("#msg-error").show(100);
$$.getElementById('msg').innerHTML = `发生错误:${
jqXHR.status
}`;
document.getElementById("login").disabled = false;
}
});
}
$("html").keydown(function (event) {
if (event.keyCode == 13) {
login();
}
});
$("#login").click(function () {
login();
});
$('div.modal').on('shown.bs.modal', function () {
$("div.gt_slider_knob").hide();
});
$('div.modal').on('hidden.bs.modal', function () {
$("div.gt_slider_knob").show();
});
})
</script>
</body></html>
Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/main/div[2]/section/div[2]/div[1]/div[1]/div/div[2]/p[2]"}
(Session info: chrome=115.0.5790.0); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
#0 0x560a61c7b613 <unknown>
#1 0x560a619a7537 <unknown>
#2 0x560a619e5f53 <unknown>
#3 0x560a619e6041 <unknown>
#4 0x560a61a212a4 <unknown>
#5 0x560a61a06a5d <unknown>
#6 0x560a61a1ed09 <unknown>
#7 0x560a61a06803 <unknown>
#8 0x560a619da68b <unknown>
#9 0x560a619db42e <unknown>
#10 0x560a61c3cc28 <unknown>
#11 0x560a61c40af7 <unknown>
#12 0x560a61c4b01c <unknown>
#13 0x560a61c41723 <unknown>
#14 0x560a61c10457 <unknown>
#15 0x560a61c65628 <unknown>
#16 0x560a61c657b7 <unknown>
#17 0x560a61c74483 <unknown>
#[18](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:19) 0x7f17b9ad0b[43](https://github.com/Oraer/cordcloud_checkin/actions/runs/5775183246/job/15652887705#step:7:44) <unknown>
作者您好,我拉取了您修改后的代码,虽然执行 Action 中 test workflow 成功了
但是并没有成功签到成功,遇到了一些问题。Selenium自动化测试时,貌似Web页面没有加载完(当然也可能是cloudflare的人机验证),导致无法定位email元素,Login失败,后续代码失效。
我使用的登录网址URL是:https://www.cordcloud.biz/
我试着解决,但是并没有起效。
错误如下:
完整报错如下: