-
Notifications
You must be signed in to change notification settings - Fork 0
/
daraz.py
71 lines (53 loc) · 2.24 KB
/
daraz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from selenium import webdriver
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support.ui import WebDriverWait
# from selenium.webdriver.support import expected_conditions as EC
# from selenium.common import exceptions
from selenium.webdriver import DesiredCapabilities
import time
import os
from win32process import CREATE_NO_WINDOW
options = webdriver.ChromeOptions()
# options.add_argument('--headless')
# options.add_argument('start-maximized')
# options.add_argument("disable-gpu")
# options.add_argument("no-sandbox")
# options.add_argument("--window-size=1920,1080")
options.add_argument("--disable-gpu")
options.add_argument("--disable-extensions")
options.add_argument("--log-level=3")
options.add_argument("--no-sandbox");
options.add_argument('--ignore-certificate-errors')
# options.add_argument("--test-type")
options.add_argument("--proxy-bypass-list=*")
options.add_argument("start-maximized")
# options.add_argument("--headless")
# chrome_options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ['enable-automation'])
prefs = {"credentials_enable_service": False}
# print(prefs)
# options.add_experimental_option("prefs", prefs)
# prefs = {"profile.password_manager_enabled": False}
options.add_experimental_option("prefs", prefs)
options.add_experimental_option("detach", False)
# driver = webdriver.Chrome(options=chrome_options);
capabilities = DesiredCapabilities.CHROME.copy()
capabilities['acceptSslCerts'] = True
capabilities['acceptInsecureCerts'] = True
driver = webdriver.Chrome(executable_path=r"chromedriver.exe", options=options)
driver.get('https://sellercenter.daraz.pk/')
# driver.set_window_position(-10000, 0)
# html_source = driver.page_source
# wait = WebDriverWait(driver, 10);
# print(html_source)
# count = 0
while True:
try:
# wait.until(ExpectedConditions.visibilityOf(driver.find_element_by_xpath('//*[@name="TPL_username"]')));
input_email = driver.find_element_by_xpath('//*[@name="TPL_username"]').send_keys('[email protected]')
input_email = driver.find_element_by_xpath('//*[@name="TPL_password"]').send_keys('life12style12@')
driver.find_element_by_xpath('//*[@class="button-submit"]').click()
break
except:
continue
# driver.execute_script('')