-1
I need to run a python script to get the url of an image that is only shown after running the page’s javascript. I am using python3 with Selenium and webdriver. However when trying to locate the link and print this with error. Follows html print and script used.
import time
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
import selenium.webdriver.chrome.service as service
from pyvirtualdisplay import Display
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
chromedriver_path = "/usr/bin/chromedriver"
chromium_path = "/usr/bin/chromium-browser"
service = service.Service(chromedriver_path)
service.start()
capabilities = {'chrome.binary': chromium_path}
opts = Options()
opts.binary_location = chromium_path
display = Display(visible=0, size=(800, 800))
display.start()
driver = webdriver.Chrome()
driver = webdriver.Chrome(chrome_options=opts)
driver.get('http://IP/devices/')
timeout = 20
image = browser.find_elements_by_xpath(("//img")
print(image, '\n')