I'm trying to extract the 'email' using selenium. I want to get the value="raipiwro@squizzy.net"
directly from the box. How can i do this ?
Website link: https://www.squizzy.de/
I'm trying to extract the 'email' using selenium. I want to get the value="raipiwro@squizzy.net"
directly from the box. How can i do this ?
Website link: https://www.squizzy.de/
Helloww, you're trying to get the attribute value
of an element
, so we should do that:
driver.find_element("tag name", 'input').get_attribute('value')
First we get the element
, then, get it's value
attribute which is the email
To extract the email address using Selenium you need to induce WebDriverWait for the visibility_of_element_located()
and you can use either of the following Locator Strategies:
Using CSS_SELECTOR
:
print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "input[name='mail']"))).get_attribute("value"))
Using XPATH
:
print(WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//input[@name='mail']"))).get_attribute("value"))
Note : You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC