Reputation: 31
> from selenium import webdriver from selenium.webdriver.common.by
> import By from selenium.webdriver.common.keys import Keys import time
> PROMISE_DOWN = 11 PROMISE_UP = 1 SPEEDTEST_URL =
> "https://www.speedtest.net/" X_EMAIL = "EMAIL" X_PASSWORD = "PASS"
>
> # noclose = webdriver.ChromeOptions()
> # noclose.add_experimental_option("detach",True)
> # driver = webdriver.Chrome(executable_path=CHROME_DRIVER_PATH,options=noclose)
>
> class InternetSpeedTwitterBot:
> def __init__(self, driver_path):
> self.driver = webdriver.Chrome(executable_path=driver_path)
> self.up = 0
> self.down = 0
>
> # ... (other methods remain the same)
>
> def get_internet_speed(self):
> def get_internet_speed(self):
> self.driver.get("https://www.speedtest.net/")
>
> # Depending on your location, you might need to accept the GDPR pop-up.
> # accept_button = self.driver.find_element_by_id("_evidon-banner-acceptbutton")
> # accept_button.click()
>
> time.sleep(3)
> go_button = self.driver.find_element_by_css_selector(".start-button a")
> go_button.click()
>
> time.sleep(120)
> self.up = self.driver.find_element_by_xpath(
> '//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[2]/div/div[2]/span').text
> self.down = self.driver.find_element_by_xpath(
> '//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[3]/div/div[2]/span').text
>
> def tweet_at_provider(self):
> pass
>
>
> bot =
> InternetSpeedTwitterBot("C:\\Users\\u\\.wade\\browser\\chromedriver.exe")
> bot.get_internet_speed() bot.tweet_at_provider()
I was making a program which will check your internet speed and post the tweet if it is not as expected by tagging the company but this is showing me chromedriver error idont know how to add or their is any other way to do it ? please help me
Upvotes: 0
Views: 1202
Reputation: 1672
Changes in Selenium 4.10.0 cause this issue, as it removes “executable_path”: https://github.com/SeleniumHQ/selenium/commit/9f5801c82fb3be3d5850707c46c3f8176e3ccd8e
You can bypass this removal by using “service”:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
service = Service(executable_path='./chromedriver.exe')
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
Another option would be using any older version of Selenium.
Upvotes: 0