1

I am trying to program a web scraping python script from a basic Google cloud server. I have succesfully downloaded selenium and chromedriver onto the VM. When I run my code i return this error

My python code is:

from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'/Users/owner/Desktop/chromedriver')
URL = 'https://www.forexfactory.com/news'

driver.get(URL)

driver.implicitly_wait(5) # wait for seconds

uiOuter = driver.find_element_by_id('ui-outer')

aHref = driver.find_elements_by_css_selector('div.flexposts__story-title a')

span = driver.find_elements_by_css_selector('div.flexposts__storydisplay-info')

headline = open("headlines.txt","w+")

for x in aHref:
    for y in span:
        headline.write(x.text + "\n" + y.text + "\n" + "\n")

The Error message is:

selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist

Im not sure exactly what this means and of course not sure what to do to fix it. All help is greatly appreciated. Thank you.

Rehan Mahmood
  • 97
  • 1
  • 7

0 Answers0