I'm writing a code which uses Selenium.
To test out a the find_element_by_css_selector
function I wrote the following code:
self.browserProfile = webdriver.ChromeOptions()
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
self.browser = webdriver.Chrome('Chrome_Driver/chromedriver', chrome_options=self.browserProfile)
self.email = email
self.password = password
self.browser.get('http://samplePage.html')
inputs = self.browser.find_element_by_css_selector('button')
print(inputs)
But I get the following error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"button"}
(Session info: chrome=70.0.3538.77)
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.15.0-45-generic x86_64)
How do I solve this error?
The chromedriver
and all required dependencies are fulfilled
I am running python 3.6.