You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
871 B
24 lines
871 B
import os
|
|
from selenium import webdriver
|
|
from selenium.webdriver.common.keys import Keys
|
|
from selenium.webdriver.common.action_chains import ActionChains
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
|
|
|
|
|
def fill_element(driver, element, text, pathtype=By.XPATH):
|
|
elem = driver.find_element(pathtype, element)
|
|
elem.send_keys(Keys.CONTROL + "a")
|
|
elem.send_keys(Keys.DELETE)
|
|
elem.send_keys(text)
|
|
|
|
|
|
def scroll_to_element(driver, element):
|
|
if element[:2] == "//":
|
|
webelem = driver.find_element_by_xpath(element)
|
|
else:
|
|
webelem = driver.find_element_by_link_text(element)
|
|
driver.execute_script("arguments[0].scrollIntoView();", webelem)
|