Reputation: 73
I am truly sorry for terrible question formulation, and incredibly thankful for the answers
QUESTION - How do I get span jsname = 'bN97Pc' in my example case. Python and selenium:
screenshot
Upvotes: 0
Views: 3200
Reputation: 29362
If you want to get jsname = 'bN97Pc'
using jsname
attribute name, you could use .get_attribute()
using below xpath
//img[contains(@src, 'https://play-lh.googleusercontent.com/a-/')]/../following-sibling::div/div[@jscontroller]/span
something like this :
ele = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//img[contains(@src, 'https://play-lh.googleusercontent.com/a-/')]/../following-sibling::div/div[@jscontroller]/span")))
print(ele.get_attribute('jsname'))
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Upvotes: 1