Home > database >  How to extract Text from div class banner-text?
How to extract Text from div class banner-text?

Time:02-21

Image Output Here

please support to extract this text from div class. I'm using the following code but it is not working.

print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//div[@class='Your object has been successfully created']//p"))).text)

CodePudding user response:

This should work out:

var = WebDriverWait(driver, 20).until(EC.visibility_of_element_located(
    (By.XPATH, "//div[@class='Your object has been successfully created']//p"))).text
print(var)

You also could try to just use the class with:

var = WebDriverWait(driver, 20).until(EC.visibility_of_element_located(
    (By.CLASS_NAME, "banner-text"))).text
print(var)

CodePudding user response:

More details would be helpful (full reproducible code and website you're trying to scrape), but I'd suggest using the Full Xpath not simply the "xpath" in chrome or firefox dev tools.

  • Related