data_runner
data_runner

Reputation: 73

get span jsname = 'value' , selenium, python

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: screenshotenter image description here

Upvotes: 0

Views: 3200

Answers (2)

Rohit
Rohit

Reputation: 386

You can use the below xpath

//span[@jsname = 'bN97Pc']

Upvotes: 1

cruisepandey
cruisepandey

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

Related Questions