|
6 | 6 |
|
7 | 7 | import time as sleepy |
8 | 8 | import sys |
| 9 | +from selenium.webdriver.chrome.service import Service |
9 | 10 | from datetime import datetime |
10 | 11 | from selenium import webdriver |
| 12 | +from selenium.webdriver.common.by import By |
11 | 13 | from selenium.webdriver.common.keys import Keys |
12 | 14 | from selenium.webdriver.firefox.options import Options |
13 | 15 | from fake_useragent import UserAgent |
|
40 | 42 | profile.set_preference("dom.webdriver.enabled", False) |
41 | 43 | profile.set_preference("useAutomationExtension", False) |
42 | 44 | profile.set_preference("marionette.enabled", False) |
43 | | - profile.set_preference('network.proxy.type', 1) |
44 | | - profile.set_preference('network.proxy.socks', '127.0.0.1') |
45 | | - profile.set_preference('network.proxy.socks_port', 9050) |
46 | 45 | profile.update_preferences() |
47 | 46 | browser = webdriver.Firefox(firefox_profile=profile) |
| 47 | + # s = Service('./chromedriver.exe') |
| 48 | + # browser = webdriver.Chrome(service=s) |
| 49 | + browser.maximize_window() |
48 | 50 | browser.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") |
49 | | - #print(profile) |
50 | | - #browser.get("https://licenses.storware.eu/vprotect/trial/") |
51 | | - browser.get("https://licenses.storware.eu/registration/vprotect?type=TRIAL") |
52 | | - #sleepy.sleep(20) |
53 | | - #perhost = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-license-wizard/form/div[1]/div/div/app-license-wizard-form-models/div/div/div[1]/label") |
54 | | - #perhost.click() |
55 | | - #hyper = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-license-wizard/form/div[1]/div/div/accordion/accordion-group[1]/div/div[1]/div/div/div") |
56 | | - #hyper.click() |
57 | | - #esxi = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-license-wizard/form/div[1]/div/div/accordion/accordion-group[1]/div/div[2]/div/app-license-wizard-form-virtual-platforms/div/div/div[5]/div[1]/div/label") |
58 | | - #esxi.click() |
59 | | - #esxi_host = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-license-wizard/form/div[1]/div/div/accordion/accordion-group[1]/div/div[2]/div/app-license-wizard-form-virtual-platforms/div/div/div[5]/div[2]/input") |
60 | | - #esxi_host.clear() |
61 | | - #sleepy.sleep(2) |
62 | | - #esxi_host.send_keys("2") |
63 | | - #next_step = browser.find_element_by_xpath('//*[@id="proceedButton"]') |
64 | | - #next_step = browser.find_element_by_id("proceedButton") |
65 | | - #next_step.click() |
66 | | - #sleepy.sleep(5) |
| 51 | + browser.get("https://storware.eu/licenses/vprotect/trial/") |
| 52 | + sleepy.sleep(10) |
| 53 | + browser.switch_to.frame(browser.find_element(By.ID, 'calculatorFrame')) |
| 54 | + browser.execute_script("document.getElementsByClassName('custom-control custom-radio custom-control-inline')[0].children[0].click()") |
| 55 | + browser.execute_script("document.getElementsByClassName('panel card panel-default')[0].children[0].click()") |
| 56 | + browser.execute_script("document.getElementsByClassName('custom-control custom-checkbox')[4].children[0].click()") |
| 57 | + value = browser.execute_script("return document.getElementsByClassName('form-control ng-untouched ng-pristine ng-valid')[0]") |
| 58 | + try: |
| 59 | + value.send_keys(Keys.CONTROL + 'a') |
| 60 | + value.send_keys('2') |
| 61 | + except: |
| 62 | + value.click() |
| 63 | + value.send_keys(Keys.CONTROL + 'a') |
| 64 | + value.send_keys('2') |
| 65 | + |
| 66 | + browser.switch_to.default_content() |
| 67 | + browser.execute_script("window.scrollTo(0, document.body.scrollHeight);") |
| 68 | + sleepy.sleep(10) |
| 69 | + browser.switch_to.frame(browser.find_element(By.ID, 'calculatorFrame')) |
| 70 | + sleepy.sleep(1) |
| 71 | + try: |
| 72 | + zbtn = browser.find_element(By.ID, 'proceedButton') |
| 73 | + print(f'1. {zbtn.text}') |
| 74 | + zbtn.click() |
| 75 | + try: |
| 76 | + print(browser.execute_script("return document.getElementById('proceedButton').textContent")) |
| 77 | + browser.execute_script("document.getElementById('proceedButton').click()") |
| 78 | + except: |
| 79 | + pass |
| 80 | + except: |
| 81 | + pass |
| 82 | + sleepy.sleep(4) |
| 83 | + |
| 84 | + |
| 85 | + |
67 | 86 | fname = browser.find_element_by_xpath('//*[@id="first-name"]') |
68 | 87 | lname = browser.find_element_by_xpath('//*[@id="last-name"]') |
69 | 88 | fname.send_keys("David") |
|
84 | 103 | role.click() |
85 | 104 | zipcode = browser.find_element_by_xpath('//*[@id="zipCode"]') |
86 | 105 | zipcode.send_keys("91119") |
87 | | - country = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-registration-form/form/div/div[1]/div/div[7]/div[3]/ngx-select-dropdown/div/div/ul[2]/li") |
| 106 | + sleepy.sleep(2) |
| 107 | + country = browser.execute_script("return document.getElementsByClassName('ngx-dropdown-button')[0]") |
88 | 108 | country.click() |
89 | | - #country.send_keys("Israel") |
90 | | - #country.click() |
91 | | - #country_name = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-registration-form/form/div/div[1]/div/div[7]/div[3]/ngx-select-dropdown/div/div/ul[1]/li") |
92 | | - #country_name.click() |
93 | | - privacy = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-registration-form/form/div/div[2]/div/div[2]/label") |
94 | | - privacy.click() |
95 | | - cap = browser.find_element_by_xpath("/html/body/div[2]/div[3]/div[1]/div/div/span/div[1]") |
96 | | - cap.click() |
| 109 | + country.send_keys(Keys.TAB) |
| 110 | + for i in range(0, 107): |
| 111 | + country.send_keys(Keys.DOWN) |
| 112 | + sleepy.sleep(2) |
| 113 | + country.send_keys(Keys.RETURN) |
| 114 | + |
| 115 | + browser.execute_script("document.getElementsByClassName('custom-control custom-checkbox')[1].children[0].click()") |
| 116 | + |
| 117 | + cap = browser.execute_script("return document.getElementsByClassName('custom-control custom-checkbox')[1].nextElementSibling.children[0]") |
| 118 | + cap = cap.find_elements(By.TAG_NAME, 'iframe')[0] |
| 119 | + |
| 120 | + browser.switch_to.frame(cap) |
| 121 | + |
| 122 | + browser.execute_script("document.getElementsByClassName('recaptcha-checkbox-border')[0].click()") |
| 123 | + sleepy.sleep(5) |
| 124 | + |
| 125 | + browser.switch_to.default_content() |
| 126 | + browser.switch_to.frame(browser.find_element(By.ID, 'calculatorFrame')) |
| 127 | + |
| 128 | + sleepy.sleep(5) |
97 | 129 | get_license = browser.find_element_by_xpath("/html/body/app-root/app-layout/app-registration-form/form/div/div[2]/div/button") |
98 | 130 | get_license.click() |
99 | 131 | sleepy.sleep(5) |
|
103 | 135 |
|
104 | 136 | print(time, ": Work. ( work", bumps, ")") |
105 | 137 | print() |
106 | | - #exit 0 |
107 | 138 | countdown = 86400 |
108 | 139 |
|
109 | 140 | for i in range(0, 8): |
110 | 141 | minutes = countdown / 60 |
111 | 142 | countdown = countdown - 900 |
112 | 143 | print('Next bump in: ', minutes, 'minutes.' ) |
113 | 144 | sleepy.sleep(900) |
| 145 | + |
0 commit comments