1

from selenium import webdriver from selenium.webdriver.chrome.service import Service

class Pinterest:
   def __init__(self, email: str, password: str) -> None:
    
    self.email = email  
    self.password = password 
    self.webdriver_path = os.path.abspath('assets/chromedriver.exe')
    self.driver = self.webdriver()  
    self.login_url = 'https://www.pinterest.com/login/'
    self.upload_url = 'https://www.pinterest.com/pin-builder/'

   def webdriver(self):
    
    options = webdriver.ChromeOptions()  
    options.add_argument('--lang=en')  
    options.add_argument('log-level=3')  
    options.add_argument('--mute-audio')  
    driver = webdriver.Chrome(service=Service(  
        self.webdriver_path), options=options) 
    driver.maximize_window()  
    return driver
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jul 29, 2022 at 2:51

1 Answer 1

1

This is because when you create the chrome web driver using

driver = webdriver.Chrome(service=Service(self.webdriver_path),options=options) 

the absolute path of the chromewebdriver.exe will be taken from PATH environment variable. In order to resolve this issue, you could either pass the path explicitly to the webdriver.Chrome class. ie,

driver = webdriver.Chrome(executable_path="<FULL PATH OF .EXE>", service=Service(self.webdriver_path),options=options) 

Or

Add the web driver path to the PATH environment variable

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.