diff --git a/README.md b/README.md index e8ff0fa..972649a 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,13 @@ On mac/pc: `pip install -r requirements.txt` -You will probably need to go get the chrome driver to make selenium work, as they are version-specific. The one in the repo might not do it for you. Find your chrome version by going to **Chrome** >> **About Google Chrome**. +This will install `webdriver-manager` to automatically download the correct chrome driver. If you are having issues opening having it open chrome, check https://github.com/SergeyPirogov/webdriver_manager. -This will open a tab that shows you your verison. Visit https://sites.google.com/chromium.org/driver/downloads and download the driver for your version. - -folder. Extract the downloaded zip file. Move the extracted chromedriver binary to this project folder - -`mv ~/Downloads/chromedriver .` - -It needs to be found in your `PATH` variable. - -`export PATH=$PATH:$(pwd)` +# Run `python req.py` to run. It will loop until you kill the job. `ctrl + c` in your terminal to give the pro lifes a break (optional). -mac: +# Chrome drivers on MacOS You might also get a trust issue with the downloaded driver being unverified. To fix that, run diff --git a/constants/urls.py b/constants/urls.py index 51d175e..340621e 100644 --- a/constants/urls.py +++ b/constants/urls.py @@ -1,2 +1 @@ -CHROMEDRIVER_PATH = './chromedriver' RESUME_PATH = '/src/resume.png' diff --git a/main.py b/main.py index f1c7eee..425565d 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,8 @@ from selenium import webdriver from selenium.webdriver.support.ui import Select +from webdriver_manager.chrome import ChromeDriverManager + from constants.common import * from constants.elementIds import * from constants.email import * @@ -16,14 +18,13 @@ from constants.xPaths import * fake = Faker() -chromedriver_location = CHROMEDRIVER_PATH # Change default in module for print to flush # https://stackoverflow.com/questions/230751/how-can-i-flush-the-output-of-the-print-function-unbuffer-python-output#:~:text=Changing%20the%20default%20in%20one%20module%20to%20flush%3DTrue print = functools.partial(print, flush=True) def start_driver(random_city): - driver = webdriver.Chrome(chromedriver_location) + driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get(CITIES_TO_URLS[random_city]) driver.implicitly_wait(10) time.sleep(2) diff --git a/requirements.txt b/requirements.txt index f32abf4..1b608ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ idna==3.2 requests==2.26.0 selenium==3.141.0 urllib3==1.26.6 -Faker==9.9.1 \ No newline at end of file +Faker==9.9.1 +webdriver-manager==3.5.2