https://huilansame.github.io/huilansame.github.io/archivers/sleep-implicitlywait-wait
https://cuiqingcai.com/2599.html
input class -------> is-invalid-input form_input__input
Rel XPath //input[@type='number']
Abs XPath /html[1]/body[1]/div[2]/div[1]/div[3]/div[3]/div[1]/div[2]/div[1]/form[1]/div[1]/div[2]/div[1]/div[1]/div[1]/input[1]
CSS sel div.App.zh div.content.logout:nth-child(3) div.Login div.form div.grid-container.row:nth-child(2) div.column.large-4.large-offset-2.medium-12.medium-offset-0.small-12 div.form_input div.form_input__wrapper > input.is-invalid-input.form_input__input
sybmit
Rel XPath
//button[@id='btn_login']
abs xpath /html[1]/body[1]/div[2]/div[1]/div[3]/div[3]/div[1]/div[2]/div[1]/form[1]/div[1]/div[2]/div[1]/button[2]
css sel #btn_login
check box
xpath //div[contains(@class,'checkbox horizontal')]//p//label[contains(@class,'checkbox__label--button')]
abs xpath /html[1]/body[1]/div[2]/div[1]/div[3]/div[3]/div[1]/div[2]/div[1]/form[1]/div[1]/div[1]/div[1]/div[1]/p[1]/label[1]
css sel div.App.zh div.content.logout:nth-child(3) div.Login div.form div.grid-container.large-mt-2rem.medium-mt-2rem.small-mt-1rem.row:nth-child(1) div.column.large-8.large-offset-2.medium-12.medium-offset-0.small-12 div.checkbox.horizontal:nth-child(2) p:nth-child(1) > label.checkbox__label.checkbox__label--button:nth-child(2)
continue
xpath //button[@id='btn_login']
abs xpath /html[1]/body[1]/div[2]/div[1]/div[3]/div[3]/div[1]/div[2]/div[1]/form[1]/div[1]/div[3]/div[1]/button[1]
css sel #btn_login
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("http://somedomain/url_that_delays_loading")
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "myDynamicElement"))
)
finally:
driver.quit()
xxx = wait.until(EC.presence_of_element_located( (By.XPATH, '//*[@id="PageContgopage"]')))
xxx = wait.until(EC.element_to_be_clickable( (By.CSS_SELECTOR, '#PageCont > a.btn_link')))
xxx = WebDriverWait(driver,10).until(
EC.presence_of_element_located((By.ID,"my_portfolio_amount"))
)
In the code above, Selenium will wait for a maximum of 10 seconds for an element matching the given criteria to be found. If no element is found in that time, a TimeoutException is thrown. By default, WebDriverWait calls the ExpectedCondition every 500 milliseconds until it returns success. ExpectedCondition will return true (Boolean) in case of success or not null if it fails to locate an element.
Expected Conditions
There are some common conditions that are frequently of use when automating web browsers. Listed below are the names of each. Selenium Python binding provides some convenience methods so you don’t have to code an expected_condition class yourself or create your own utility package for them.
title_is
title_contains
presence_of_element_located
visibility_of_element_located
visibility_of
presence_of_all_elements_located
text_to_be_present_in_element
text_to_be_present_in_element_value
frame_to_be_available_and_switch_to_it
invisibility_of_element_located
element_to_be_clickable
staleness_of
element_to_be_selected
element_located_to_be_selected
element_selection_state_to_be
element_located_selection_state_to_be
alert_is_present
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.ID, 'someid')))
from selenium import webdriver
driver = webdriver.Firefox()
driver.implicitly_wait(10) # seconds
driver.get("http://somedomain/url_that_delays_loading")
myDynamicElement = driver.find_element_by_id("myDynamicElement")