Coder Social home page Coder Social logo

pkuautosubmit's Introduction

PKUAutoSubmit

PKU一键出入校备案小工具 v3.2 (2021.11.15)

听闻近期由于疫情原因恢复了报备制度,然而由于作者已毕业离校,无法访问完整的 portal 功能进行测试及维护。往后的更新基本仅来源于在校学生的 PR 并无法进行完整测试,建议 fork 后根据自身情况参考 issue 进行完善

已知问题

  • PhantomJSdriver 问题可尝试 chromedriver 并取消注释 main.py 的相应代码,参考PR#40
  • portal 未绑定手机时会出现错误,参考#31
  • 最新版本 selenium 已停止对 PhantomJS 的支持, 2.48.03.8.0 版本测试正常,参考#35
  • 发行版 v3.0 可能出现登录问题,请采用最新 repo 或发行版,参考#35

感谢同学们的支持,祝大家一切顺利,学业有成!

为作者的第一个 selenium 练手小项目,完善程度较低,欢迎任意类型的使用与开发改进

说明

  • 本工具采用 Python3 搭配 selenium 完成自动化操作,实现全自动填报学生出入校备案,为频繁出入校的 PKU 学子(不频繁也行)提供较为便捷的解决方案
  • 支持多个配置文件,可在一个进程内同时进行多人填报
  • 支持设置在运行结束后返回历史备案页面截图,无需自行登录查看备案结果
  • 支持基于Server酱的备案结果微信推送功能,体验更佳
  • 采用定时任务可实现定期(如每日)免打扰填报
  • 第三方依赖包几乎只有 selenium 一个,从下到用贼jr快

安装与需求

Python 3

本项目需要 Python 3,可以从Python 官网下载安装

本项目采用 Python 3.7.4 开发,由于含有 f-string ,请至少使用 Python 3.6 及以上版本,建议使用 Python 3.7 及以上版本

Packages

selenium

采用如下命令安装 selenium,支持 2.48.0 及以上版本(注意最新版本不支持 PhantomJS):

pip3 install selenium==2.48.0

然后就没了。惊不惊喜?意不意外?

基本用法

  1. config.sample.ini 文件重命名为 config.ini ,请不要新建文件,不然自己搞定编码问题

  2. 用文本编辑器(建议代码编辑器)打开 config.ini 文件

  3. 配置 [login][common][out][in][capture][wechat] 这几个 Section 下的变量,在 config.ini 文件内有详细注释

  4. 若需要多人同时填报,可将 config.ini 文件复制若干份,分别重命名为 config+序号.ini 例如 config1.ini, config2.ini...并配置对应变量

    Note: 序号仅作匹配用,具体数值不重要,但是非法命名格式可能导致检测失败

  5. 进入项目根目录,以命令 python main.py 运行主程序

    • 亦可双击 run.bat 运行(仅限 Windows 系统)
    • 亦可用代码编辑器打开 main.py 并运行(并不推荐)

定时运行

Windows

本项目中的 autoRun.bat 文件可提供在静默免打扰情况下运行程序的选择,配合 Windows 任务计划管理可实现定期自动填报,具体请参考Win10下定时启动程序或脚本

mac OS

进入项目根目录,以命令 ./macAutoRun.sh 执行 macAutoRun.sh 脚本即可,可设定或取消定时运行

Linux

使用 Linux 系统的小伙伴们想必有一定的 shell 基础,那大佬们就自行用 crontab 设置吧~

Note: 静默运行的弊端为无法看到任何报错信息,若程序运行有错误,使用者很难得知。故建议采用定时静默运行时,设置微信推送,在移动端即可查看到备案成功信息。或设置备案历史截图功能并定期查看截图(似乎出现了问题,极不推荐)

利用 GitHub Actions 自动运行

fork 本仓库后,在 config.sample.ini 中修改除学号密码以外的参数

然后在自己仓库的 settings->secrets->New repository secret 中新建 Name 为 STUDENTNUM, Value 为学号;Name 为 passwd,Value为密码

默认每天晚上0点起每四个小时跑一次,可能会运行失败

微信推送

本项目支持基于Server酱的微信推送功能,仅需登录并扫码绑定,之后将获取到的 SCKEY 填入 config.ini 文件即可

Note: 因微信将于4月底下线模板消息功能,届时推送功能也将同步更新为Server酱-Turbo。所以有微信推送需求的小伙伴们可以提前做好准备,并关注本项目的未来版本

补充说明

  • 本项目主要为校内日常出入的同学提供便捷解决方案,会同时填报出校与入校备案,不支持单独填报,也不支持京外返校填报。若有此类特殊需求,烦请手动填报
  • PhantomJS 作为经典的轻量级无头浏览器,相较 Chrome 等大型浏览器体量小的多,不占空间且运行快速。但是由于其本身属性也可能造成一系列问题,如:
    • 由于仅为练手项目,对于学校土豆服务器造成的各类玄学问题作者只能尽力避免,但并无完善的 Exception 处理机制,若遇到报错欢迎 issue,且万能的重来一次大法可以解决绝大多数问题
    • 可能某天 seleniumPhantomJS 停止了支持,那到了那天再想别的办法(果然到这天了)
  • 当前看来,无论出不出学校都可以填报备案,所以每天定时运行一次并没有什么问题(事实上,作者在测试阶段每天填几十次,希望人没事.jpg)

责任须知

  • 本项目仅供参考学习,造成的一切后果由使用者自行承担
  • 本项目敏感性不比 skj,利人利己,私以为还是可以合理扩散一下的,吧?

证书

Apache License 2.0

版本历史

version 3.2

  • 发布于 2021.11.15
  • 更新以支持最新填报系统(感谢 Housyou 的 contribution)
  • 增加 Github Actions(感谢 ErnestDong 的 contribution)

version 3.1

  • 发布于 2021.11.6
  • 更新了 Linux 的 phantomjs 版本(感谢 David Wang 的 contribution)

version 3.0

  • 发布于 2021.3.10
  • 支持多人同时填报
  • 修复 driver 启动时可能出现的问题(感谢 AOZMH 的 contribution)
  • 优化运行稳定性

version 2.3

  • 发布于 2020.10.19
  • 加入微信推送功能(感谢 XiaoTian 的 contribution)
  • 支持 Linux 系统
  • 修复填报逻辑问题可能引发的错误
  • 终极修复【希望吧】可能的会话失效导致填报失败的问题
  • 统一代码风格

version 2.1

  • 发布于 2020.10.11
  • 加入 mac OS 取消定时运行
  • 第一个 release 版本

version 2.0

  • 发布于 2020.10.10
  • 支持 mac OS 设置定时运行,并加入运行前环境检查(感谢 mojave 的 contribution)

version 1.9.1

  • 发布于 2020.10.10
  • 修复填报入校备案时可能出现的会话失效导致填报失败的问题

version 1.9

  • 发布于 2020.10.5
  • 支持 mac OS 系统(感谢 JuiAnHsu 的 contribution)

version 1.1

  • 发布于 2020.10.5
  • 修复 iaaa 认证时第一次必触发 500 错误的问题(感谢 Rainshaw 的 contribution)

version 1.0

  • 发布于 2020.10.4
  • 项目初始版本

pkuautosubmit's People

Contributors

aozmh avatar bruuuuuuce avatar cbwang2016 avatar mickelliu avatar mojave-pku avatar rainshaw avatar sakuralaurel avatar xiaotianxt avatar xn6o6x avatar yousiki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pkuautosubmit's Issues

找不到属性 'PhantomJS'

运行run.bat,报错信息如下:
C:\Users\hhhh\Downloads\PKUAutoSubmit-main>python main.py
环境检查通过
Traceback (most recent call last):
File "C:\Users\hhhh\Downloads\PKUAutoSubmit-main\main.py", line 44, in
driver_pjs = webdriver.PhantomJS(executable_path=sys_path(browser="phantomjs"))
AttributeError: module 'selenium.webdriver' has no attribute 'PhantomJS'

操作系统:win10
Python版本:3.10
selenium已更新到最新版本

请问MacOS下如何取消定时运行呀?

请问MacOS下如何取消定时运行呀?

文章说MacOS可以取消定时运行,不过没有说清楚如何取消?是要再运行一次 ./macAutoRun.sh 命令吗,那要输入什么数字啊,感谢!

func.py里的go_to_simso(driver)函数中的driver.find_element_by_id('all').click()报错

完整报错信息如下

环境检查通过

DevTools listening on ws://127.0.0.1:54967/devtools/browser/7f104549-c65e-44d0-bff5-7ced32eed9f2
Driver Launched

读取到1份配置文件

||第1个学生备案||
门户登陆中...
[1026/120453.418:INFO:CONSOLE(84)] "pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details.", source: https://portal.pku.edu.cn/portal2017/js/angular.min.js (84)
[1026/120454.771:INFO:CONSOLE(84)] "pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details.", source: https://portal.pku.edu.cn/portal2017/js/angular.min.js (84)
门户登录成功!

Traceback (most recent call last):
File "main.py", line 68, in
go('config.ini')
File "main.py", line 38, in go
run(driver_pjs, userName, password, campus, reason, destination, track,
File "C:\Users\shim\Desktop\WORKSPACE\PKUAutoSubmit-main\PKUAutoSubmit-main\func.py", line 245, in run
go_to_application_out(driver)
File "C:\Users\shim\Desktop\WORKSPACE\PKUAutoSubmit-main\PKUAutoSubmit-main\func.py", line 57, in go_to_application_out
go_to_simso(driver)
File "C:\Users\shim\Desktop\WORKSPACE\PKUAutoSubmit-main\PKUAutoSubmit-main\func.py", line 46, in go_to_simso
driver.find_element_by_id('all').click()
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 693, in _execute
return self._parent.execute(command, params)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
self.error_handler.check_response(response)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (1141, 459). Other element would receive the click:


(Session info: headless chrome=95.0.4638.54)
Stacktrace:
Backtrace:
Ordinal0 [0x00DEBDE3+2473443]
Ordinal0 [0x00D86661+2057825]
Ordinal0 [0x00C92438+1057848]
Ordinal0 [0x00CC27B9+1255353]
Ordinal0 [0x00CC0AE0+1247968]
Ordinal0 [0x00CBE8AD+1239213]
Ordinal0 [0x00CBD701+1234689]
Ordinal0 [0x00CB3567+1193319]
Ordinal0 [0x00CD56E3+1332963]
Ordinal0 [0x00CB3386+1192838]
Ordinal0 [0x00CD57CA+1333194]
Ordinal0 [0x00CE4ABF+1395391]
Ordinal0 [0x00CD55AB+1332651]
Ordinal0 [0x00CB2104+1188100]
Ordinal0 [0x00CB2F59+1191769]
GetHandleVerifier [0x00F72266+1549718]
GetHandleVerifier [0x0101D4A7+2250711]
GetHandleVerifier [0x00E7718B+521403]
GetHandleVerifier [0x00E76229+517465]
Ordinal0 [0x00D8B79D+2078621]
Ordinal0 [0x00D8FB58+2095960]
Ordinal0 [0x00D8FC92+2096274]
Ordinal0 [0x00D99541+2135361]
BaseThreadInitThunk [0x767CFA29+25]
RtlGetAppContainerNamedObjectPath [0x77407A9E+286]
RtlGetAppContainerNamedObjectPath [0x77407A6E+238]

Screenshot: available via screen解决方案

本人使用的时候也会时不时报错,和#12 一样的问题:

selenium.common.exceptions.TimeoutException: Message: Screenshot: available via screen

因此建议在go_to_application_outgo_to_application_in两个函数执行click的时候多试几次:

while 'editApplyInfo' not in driver.current_url:
    driver.find_element_by_class_name('el-card__body').click()
    time.sleep(0.5)

ubuntu系统下的执行问题

PhantomJS的版本不对,报执行格式错误。包里带的PhantomJS应该是macOS版的。我到官网下了个Linux版本的就正常了。
或许可以把PhantomJS替换一下,单发个Linux版,毕竟挂阿里云腾讯云的学生机比挂自己电脑上稳定(

10.24测试报备截图失败

在func.py的screencapture函数中卡住了

TimeOutException,尝试调大timeout也不行

完整错误信息:
Traceback (most recent call last):
File "D:*\PKUAutoSubmit\main.py", line 64, in
go('config.ini')
File "D:*
\PKUAutoSubmit\main.py", line 38, in go
run(driver_pjs, userName, password, campus, reason, destination, track,
File "D:*\PKUAutoSubmit\func.py", line 254, in run
screen_capture(driver, path)
File "D:*
\PKUAutoSubmit\func.py", line 219, in screen_capture
WebDriverWait(driver, 20).until(
File "C:\Users***\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 89, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
Backtrace:
Ordinal0 [0x0061BDE3+2473443]
Ordinal0 [0x005B6661+2057825]
Ordinal0 [0x004C2438+1057848]
Ordinal0 [0x004EC7DB+1230811]
Ordinal0 [0x00516712+1402642]
Ordinal0 [0x0050571A+1333018]
Ordinal0 [0x00514ABF+1395391]
Ordinal0 [0x005055AB+1332651]
Ordinal0 [0x004E2104+1188100]
Ordinal0 [0x004E2F59+1191769]
GetHandleVerifier [0x007A2266+1549718]
GetHandleVerifier [0x0084D4A7+2250711]
GetHandleVerifier [0x006A718B+521403]
GetHandleVerifier [0x006A6229+517465]
Ordinal0 [0x005BB79D+2078621]
Ordinal0 [0x005BFB58+2095960]
Ordinal0 [0x005BFC92+2096274]
Ordinal0 [0x005C9541+2135361]
BaseThreadInitThunk [0x76F6FA29+25]
RtlGetAppContainerNamedObjectPath [0x770D7A9E+286]
RtlGetAppContainerNamedObjectPath [0x770D7A6E+238]

portal未绑定手机时会出现错误

当portal未绑定手机号时登录portal会出现绑定微信公众号的全屏提示,只有关闭这个提示框才能进行下一步操作。

但在func.py->go_to_simso()函数中没有相应的处理(这种情况也确实比较少),因此会出现如下错误:

Traceback (most recent call last):
  File "main.py", line 64, in <module>
    go('config.ini')
  File "main.py", line 39, in go
    habitation, district, street, capture, path, wechat, sckey)
  File "G:\PKUData\PKUAutoSubmit\func.py", line 245, in run
    go_to_application_out(driver)
  File "G:\PKUData\PKUAutoSubmit\func.py", line 57, in go_to_application_out
    go_to_simso(driver)
  File "G:\PKUData\PKUAutoSubmit\func.py", line 46, in go_to_simso
    driver.find_element_by_id('all').click()
  File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webelement.py", line 693, in _execute
    return self._parent.execute(command, params)
  File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "D:\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: 
Element <a id="all" href="#/bizCenterAll" ng-click="click()" target="" class="biz-item" portlet-href="#/bizCenterAll" portlet-id="all" portlet-class="biz-item" portlet-lang="zh" portlet-name="全部" portlet-name-en="All" is-finished="Y" portlet-target="" style="background-image: url(&quot;./img/biz-icon-all.svg&quot;);">...</a> is not clickable at point (689, 433). Other element would receive the click: <div class="lightbox_back ng-scope" ng-click="closeInfoTip()" id="infoTipBg" style="display: block;"></div>
  (Session info: headless chrome=94.0.4606.81)

以下两种方法可消除这个错误:
1、绑定微信公众号,即可使登录portal时不再弹框。
2、将func.py->go_to_simso()中第一行改为driver.get('https://portal.pku.edu.cn/portal2017/#/bizCenterAll')

建议将这个情况写入README.md中,谢谢!

selenium TimeoutException

11月18日开始这样﹐之前试过也没啥问题﹐在本地运行也没问题﹐但放上action弄就一直超时了﹐不知道是不是我操作上的错误?
WebDriverWait那个原本是10的﹐出错了几次我试过自己改成60﹐但还是没作用。
麻烦作者了。

Run python3 main.py
Traceback (most recent call last):
  File "/home/runner/work/PKUAutoSubmit/PKUAutoSubmit/main.py", line 75, in <module>
    go(config)
  File "/home/runner/work/PKUAutoSubmit/PKUAutoSubmit/main.py", line 43, in go
    run(driver_pjs, userName, password, campus, reason, detail, destination, track,
  File "/home/runner/work/PKUAutoSubmit/PKUAutoSubmit/func.py", line 264, in run
    fill_out(driver, campus, reason, detail, destination, track)
  File "/home/runner/work/PKUAutoSubmit/PKUAutoSubmit/func.py", line 191, in fill_out
    submit(driver)
  File "/home/runner/work/PKUAutoSubmit/PKUAutoSubmit/func.py", line 155, in submit
    WebDriverWait(driver, 60).until(
  File "/usr/share/miniconda/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Screenshot: available via screen

环境检查通过
Driver Launched

读取到1份配置文件

||第1个学生备案||
门户登陆中...
Retrying...
门户登陆中...
门户登录成功!
=================================
开始填报出校备案
选择出校/入校    Done
选择校区    Done
填写出入校事由    Done
填写出入校事由详细描述    Done
选择出校目的地    Done
填写出校行动轨迹    Done
Error: Process completed with exit code 1.

DOM不会更新,一直卡在登陆中

作者大大你好,今天貌似自动报备没有成功。貌似是因为一直会卡在“登陆中"没有跳转,所以找不到“全部”按钮也就是”id=all"。

但是输错误的账户密码还是会显示账户密码错误。

请救救没法苗的孩子

1634277920(1)

门户登陆不上去

请问这是什么原因呢?门户老是登陆不上去
D:\PKUAutoSubmit-main>python main.py
环境检查通过
Driver Launched

读取到1份配置文件

||第1个学生备案||
门户登陆中...
Retrying...
门户登陆中...
Retrying...
门户登陆中...
Retrying...
Traceback (most recent call last):
File "D:\PKUAutoSubmit-main\func.py", line 38, in login
5).until(EC.visibility_of_element_located((By.ID, 'all')))
File "D:\Users\Aozai\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Screenshot: available via screen

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\PKUAutoSubmit-main\func.py", line 38, in login
5).until(EC.visibility_of_element_located((By.ID, 'all')))
File "D:\Users\Aozai\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Screenshot: available via screen

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\PKUAutoSubmit-main\func.py", line 38, in login
5).until(EC.visibility_of_element_located((By.ID, 'all')))
File "D:\Users\Aozai\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Screenshot: available via screen

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\PKUAutoSubmit-main\main.py", line 62, in
go('config.ini')
File "D:\PKUAutoSubmit-main\main.py", line 38, in go
run(driver_pjs, userName, password, campus, reason, detail, destination, track,
File "D:\PKUAutoSubmit-main\func.py", line 260, in run
login(driver, userName, password)
File "D:\PKUAutoSubmit-main\func.py", line 42, in login
login(driver, userName, password, retry + 1)
File "D:\PKUAutoSubmit-main\func.py", line 42, in login
login(driver, userName, password, retry + 1)
File "D:\PKUAutoSubmit-main\func.py", line 42, in login
login(driver, userName, password, retry + 1)
File "D:\PKUAutoSubmit-main\func.py", line 17, in login
raise Exception('门户登录失败')
Exception: 门户登录失败

纯HTTP的自动填报

貌似使用selenium会不定期出现

selenium.common.exceptions.TimeoutException: Message: 
Screenshot: available via screen

的错误,必须要手动re-run很影响体验,比如 https://github.com/YOUSIKI/PKUAutoSubmit/runs/1271524630,https://github.com/yzs981130/PKUAutoSubmit/actions?query=is%3Afailure,https://github.com/Bruuuuuuce/PKUAutoSubmit/issues/9#issuecomment-710149802

仔细研究了一下整个iaaa到simso的认证过程,写了一个纯HTTP的交互,见https://github.com/yzs981130/autoSubmit ,也支持了github actions,使用方法与 @YOUSIKI 一样

写的很糙,错误处理都没做,readme也还没写,欢迎pr,也欢迎直接移植到本repo,省去用selenium和phantomjs的烦恼

关于README(不成熟的小提议)

感觉README里写现在的feature就好了吧,剩下的都写在update log里,再加上log的日期,不然分不清哪些是现在的bug哪些是已修复哪些是feature,有点晕

11月14日开始 selenium TimeOutException

之前一直正常,今天早上没有报备成功,输出信息如下:

环境检查通过
Driver Launched

读取到1份配置文件

||第1个学生备案||
门户登陆中...
门户登录成功!
=================================
开始填报出校备案
选择出校/入校    Done
选择校区    Done
填写出入校事由    Done
选择出校目的地    Traceback (most recent call last):
  File "main.py", line 62, in <module>
    go('config.ini')
  File "main.py", line 38, in go
    run(driver_pjs, userName, password, campus, reason, destination, track,
  File "/home/zao/Desktop/Doing/PKUAutoSubmit/func.py", line 247, in run
    fill_out(driver, campus, reason, destination, track)
  File "/home/zao/Desktop/Doing/PKUAutoSubmit/func.py", line 171, in fill_out
    select_destination(driver, destination)
  File "/home/zao/Desktop/Doing/PKUAutoSubmit/func.py", line 102, in select_destination
    WebDriverWait(driver, 10).until(
  File "/home/zao/.local/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

Mac OS下出现疑似权限问题

报错信息:

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: './phantomjs/bin/phantomjs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 45, in <module>
    service_args=['--ignore-ssl-errors=true', '--ssl-protocol=TLSv1'])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 56, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 88, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable may have wrong permissions. 

sudo指令和直接在资源管理器改权限均无效,求指教

初入校策略更换

初入校策略马上就要变化了,猜测报备代码需要更改,如需要选择离开的校门等。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.