html – How can I get class content in Selenium Web Driver?

Code: Selenium Import from Import Options Web Driver

options = webdriver.ChromeOptions () options.add_argument (r “-user-data-dir = C: ers Users bji AppData Local Google Chrome User Data”) #eg C: Users You AppData Local Google Chrome User Data Options .add_argument (r ‘-profile-directory = Default’) #eg Profile 3 driver = webdriver.Chrome (execute_path = r’C: ers Users bji Downloads chromedriver_win32 (1) ro chromedriver.exe ‘, chrome_options = options)

driver.get (‘Wanted Website’)

content = driver.find_element_by_xpath (‘// *[@id=”__layout”]/ div / div[2]/ div[1]/ div[1]/ div / div[2]/ ul / li[1]/ a / div[3]/ div[2]/ div / p ‘)

If (content == 24): ()

And this is my HTML code: 24.

Write a Comment

Your email address will not be published. Required fields are marked *