Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrome版本更新出现兼容性问题导致失效,使用webdriver自动下载版本一劳永逸 #40

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ PKU一键出入校备案小工具 v3.2 (2021.11.15)
pip3 install selenium==2.48.0
```

#### webdriver_manager

```
pip3 install webdriver_manager
```

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

## 基本用法
Expand Down
15 changes: 8 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import env_check
from configparser import ConfigParser
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from func import *
import warnings
import sys
Expand Down Expand Up @@ -41,14 +42,14 @@ def go(config):

if __name__ == '__main__':

driver_pjs = webdriver.PhantomJS(executable_path=sys_path(browser="phantomjs"))
# driver_pjs = webdriver.PhantomJS(executable_path=sys_path(browser="phantomjs"))

# chrome_options = Options()
# chrome_options.add_argument("--headless")
# driver_pjs = webdriver.Chrome(
# options=chrome_options,
# executable_path=sys_path(browser="chromedriver"),
# service_args=['--ignore-ssl-errors=true', '--ssl-protocol=TLSv1'])
chrome_options = Options()
chrome_options.add_argument("--headless")
driver_pjs = webdriver.Chrome(
executable_path=ChromeDriverManager().install(),
options=chrome_options,
service_args=['--ignore-ssl-errors=true', '--ssl-protocol=TLSv1'])
print('Driver Launched\n')

lst_conf = sorted([
Expand Down