SHARE
TWEET

Untitled

a guest May 23rd, 2018 342 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from selenium import webdriver
  2. from selenium.webdriver.common.keys import Keys
  3. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  4. from selenium.webdriver.common.by import By
  5. from selenium.webdriver.support.ui import WebDriverWait
  6. from selenium.webdriver.support import expected_conditions as EC
  7. from time import sleep
  8. from selenium.webdriver.chrome.options import Options
  9. from selenium.common.exceptions import TimeoutException
  10. from urllib.parse import urlparse
  11.  
  12. opt = Options()
  13. opt.add_argument("--disable-infobars")
  14. opt.add_argument("start-maximized")
  15. opt.add_argument("--disable-extensions")
  16.  
  17. opt.add_experimental_option("prefs", { \
  18.     "profile.default_content_setting_values.media_stream_mic": 1,
  19.     "profile.default_content_setting_values.media_stream_camera": 1,
  20.     "profile.default_content_setting_values.geolocation": 1,
  21.     "profile.default_content_setting_values.notifications": 1
  22. })
  23.  
  24. browser = webdriver.Chrome(executable_path='./chromedriver', chrome_options=opt)
  25. browser.maximize_window()
  26.  
  27.  
  28.  
  29. address = "https://swamp.fully-verified.com/customers/login/"
  30. email_login = "karczewskipawel.j@gmail.com"
  31. password_login = "planner0110"
  32. new_verification = "karczewskipawel.j+newverification@gmail.com"
  33.  
  34. browser.get(address)
  35. if not "Login" in browser.title:
  36.     raise Exception("Unable to load Login Fully-Verified page!")
  37.  
  38. username = browser.find_element_by_id("id_username")
  39. username.send_keys(email_login)
  40.  
  41. password = browser.find_element_by_id("id_password")
  42. password.send_keys(password_login)
  43.  
  44. btn_login = browser.find_element_by_css_selector(".btn.btn-primary.btn-block")
  45. btn_login.click()
  46.  
  47. integration_demo = browser.find_element_by_xpath("//a[@href='/customers/demo']")
  48. integration_demo.click()
  49.  
  50. user_email = browser.find_element_by_id("id_email")
  51. user_email.clear()
  52. user_email.send_keys(new_verification)
  53.  
  54. btn_verify = browser.find_element_by_id("verify")
  55. btn_verify.click()
  56. sleep(5)
  57.  
  58. btn_web = browser.find_element_by_id("web_btn")
  59. sleep(5)
  60. # element = WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.ID, "web_btn")))
  61. btn_web.click()
  62.  
  63. start = browser.find_element_by_css_selector(".btn.btn-start")
  64. sleep(5)
  65. start.click()
  66. sleep(5)
  67.  
  68. print(browser.current_url)
  69.  
  70. url = browser.current_url
  71. hash = url.rpartition('https://swamp.fully-verified.com/web/verification_waiting/')
  72. print(hash[2])
  73.  
  74. user_hash = hash[2]
  75. user_hash = user_hash.replace('/', '')
  76. user_hash = user_hash[40:104]
  77. print(user_hash)
  78.  
  79.  
  80.  
  81. snd_browser = webdriver.Chrome(executable_path='./chromedriver')
  82. snd_browser.maximize_window()
  83.  
  84. snd_address = "https://swamp.fully-verified.com/ops/login/"
  85. snd_email_login = "admin@swamp.fully-verified.com"
  86. snd_password_login = "fvadminfv"
  87.  
  88. snd_browser.get(snd_address)
  89.  
  90. username = snd_browser.find_element_by_id("id_username")
  91. username.send_keys(snd_email_login)
  92.  
  93. password = snd_browser.find_element_by_id("id_password")
  94. password.send_keys(snd_password_login)
  95.  
  96. btn_login = snd_browser.find_element_by_css_selector(".btn.btn-success.btn-block")
  97. btn_login.click()
  98. sleep(5)
  99.  
  100.  
  101. # strMyXPath = "//a[@href='/ops/verify/" + user_hash + "0/']"
  102. # print(strMyXPath)
  103.  
  104.  
  105. snd_browser.find_element_by_xpath("//a[@href='/ops/verify/" + user_hash + "/0/']").click()
  106. sleep(1)
  107. snd_browser.find_element_by_id("dropdownMenu1").click()
  108. sleep(20)
  109. # snd_browser.find_element_by_xpath("//a[@href='#']").click()
  110. snd_browser.find_element_by_link_text('Failed').click()
  111. sleep(1)
  112.  
  113.  
  114.  
  115.  
  116. delay = 20  # seconds
  117. try:
  118.     myElem = WebDriverWait(browser, delay).until(EC.presence_of_element_located((By.ID, 'rating_text')))
  119.     print("I see it")
  120.     sleep(5)
  121.  
  122.     star = browser.find_element_by_xpath('//*[@title="Awesome - 5 stars"]')
  123.     star.click()
  124.     # sleep(3)
  125.     #
  126.     note = browser.find_element_by_id("rating_text")
  127.     note.send_keys("Super! Five star!")
  128.     sleep(3)
  129.  
  130.     btn_endverification= browser.find_element_by_css_selector(".btn.btn-end")
  131.     btn_endverification.click()
  132.     sleep(1)
  133.  
  134.  
  135. except TimeoutException:
  136.     print("Too much time")
  137.  
  138.  
  139. browser.quit()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top