from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 10).until_not(EC.visibility_of_element_located((By.XPATH, "//span[@id='progressMessage']"))
By pay = By.id("pay")
@Test
publuc void UserShoudBeAdblePay(){
...
driver.findElement(pay).click();
}
public void putInBasket() {
driver.findElement(By.id("pay")).click();
}
public void putInBasket() {
driver.findElement(By.id("drop-down")).click();
driver.findElement(By.id("pay")).click();
}
driver.add_cookie({'name': 'SameSite', 'value': 'None'})
from selenium import webdriver
from selenium.webdriver.support.ui import Select
select = Select(driver.find_element_by_class_name('my-class'))
select.select_by_visible_text('Two')
$element = $driver->findElement(WebDriverBy::id('id'));
$element->getAttribute('innerHTML');
elementToBeClickable
driver.find_element_by_xpath("//*[.='я не робот']").click()
def something:
driver = webdriver.Chrome()
driver.get('https://yandex.ru')
driver.execute_script(
"var btn = document.getElementById('wd-_teaser');"
"var checkbox = document.createElement('input');"
"var label = document.createElement('label');"
"label.appendChild(document.createTextNode('GOOD'));"
"checkbox.type = 'checkbox';"
"checkbox.id = 'randomID';"
"btn.appendChild(checkbox);"
"btn.appendChild(label);")
element = driver.find_element_by_id("randomID")
while not element.is_selected():
time.sleep(2)
driver.switch_to.frame(webelement)
driver.switchTo.frame(0)
browser.maximize_window()
--window-size=1200,600
browser.execute_script(s"return (function(webelement, text) {" +
"if (webelement.getAttribute('readonly') != undefined) return 'Cannot change value of readonly element';" +
"if (webelement.getAttribute('disabled') != undefined) return 'Cannot change value of disabled element';" +
"webelement.focus();" +
"var maxlength = webelement.getAttribute('maxlength') == null ? -1 : parseInt(webelement.getAttribute('maxlength'));" +
"webelement.value = " +
"maxlength == -1 ? text " +
": text.length <= maxlength ? text " +
": text.substring(0, maxlength);" +
"return null;" +
"})(arguments[0], arguments[1]);", element, text)