I'm new about using python and selenium and I'm trying to get the image source from a website. I'm actually finding elements by the tag name, but I don't know if it's the right way. Anyway it gives me an error:
InvalidArgumentException: Message: invalid argument: 'using' must be a string
Under this there's the code I wrote
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
PATH = Service("/Users/fscozano/documenti/chromedriver-2.exe")
print("setup")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://apod.nasa.gov/apod/random_apod.html")
tag = driver.find_element((By.TAG_NAME, "b")).getText()
print(tag)
driver.quit()
The error is in:
tag = driver.find_element((By.TAG_NAME, "b")).getText()
You can personally inspect the website because I really don't know how to solve this Every type of help is appreciated :)