Selenium webdriver on Ubuntu does not return data

259 Views Asked by At

I use this part of code on Windows 10 and it works fine and the driver gets the data. When running on Ubuntu 20.04 the driver works without errors but doesn't receive anything. Specifically, the driver.requests is empty. Google Chrome and libraries are installed, chromedriver exists. I would be grateful if you could help me find out what could be the reason. This part of the code has been edited for Ubuntu.

#!/usr/bin/python
# -*- coding: utf-8 -*-

from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options
import time

chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(executable_path="/usr/bin/chromedriver", options=chrome_options)
driver.get("myUrl")
time.sleep(3)
x = ""

for request in driver.requests:
    if "chip" in request.url:
        x = str(request)
        break

print(x)
0

There are 0 best solutions below