Untitled

mail@pastecode.io avatar
unknown
python
3 years ago
3.1 kB
7
Indexable
Never
import time
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
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.common.exceptions import TimeoutException
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Opera()
browser.get("https://example.com")
delay = 3 # seconds
try:
    myElem = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.ID, 'password')))
    print ("Page is ready!")
except TimeoutException:
    print ("Loading took too much time!")

    
elem = browser.find_element_by_id("password")
elem.clear()
elem.send_keys("pwddd")
elem.send_keys(Keys.ENTER)


time.sleep(10)


rightaction = ActionChains(browser)
rightaction.move_to_element(browser.find_element_by_xpath("/html/body/div[5]/div/div[3]/div[1]/div/table/tbody/tr[1]/td[11]")).perform();
rightaction.context_click().perform()


leftaction = ActionChains(browser)
leftaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div/span[3]/span/div[17]")).click();
leftaction.context_click().perform()
webdriver.ActionChains(browser).send_keys(Keys.ESCAPE).perform()


orderaction = ActionChains(browser)
orderaction.move_to_element(browser.find_element_by_xpath("/html/body/div[5]/div/div[3]/div[1]/div/table/tbody/tr[1]/td[11]")).perform();
orderaction.double_click().perform()



symbolorderaction = ActionChains(browser)
symbolorderaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/label[11]")).click();
symbolorderaction.click().perform()

keysorderaction = ActionChains(browser)
keysorderaction.send_keys("fghs LLc").perform()



dotaction = ActionChains(browser)
dotaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/label[12]")).click();
dotaction.click().perform()


enteraction = ActionChains(browser)
enteraction.send_keys("3413").perform()



llabelaction = ActionChains(browser)
llabelaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/label[13]")).click();
llabelaction.click().perform()

entersaction = ActionChains(browser)
entersaction.send_keys("87931").perform()



Tlaction = ActionChains(browser)
Tlaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/label[14]")).click();
Tlaction.click().perform()

enterPaction = ActionChains(browser)
enterPaction.send_keys("92592").perform()
 

commentaction = ActionChains(browser)
commentaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/label[15]")).click();
commentaction.click().perform()
 
enterCommentaction = ActionChains(browser)
enterCommentaction.send_keys("qwe").perform()
 


commentlabelaction = ActionChains(browser)
commentlabelaction.move_to_element(browser.find_element_by_xpath("/html/body/div[16]/div/div[3]/button[13]")).click();
commentlabelaction.click().perform()

assert "No results found." not in browser.page_source