-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
86 lines (57 loc) · 2.85 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from login import *
from utilities import *
import autoPush
import getpass
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from webdriver_manager.firefox import GeckoDriverManager
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
def main():
clear_screen()
# chrome_options = Options()
# chrome_options.headless = True
firefox_options = Options()
# firefox_options.add_argument("--disable-extensions")
firefox_options.add_argument("--start-maximized")
# firefox_options.headless = True
# driver = webdriver.Chrome(ChromeDriverManager().install(), options=)
driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()), options=firefox_options)
driver.get("https://seller.shopee.co.id/account/signin?next=%2F")
try:
print("Enter your email address or phone number: ")
# username_email = input("> ")
print("Enter your password (it won't appear in the terminal): ")
# password = getpass.getpass("> ")
username_email = "081387676573"
password = "Paul_0999"
# if login succeed:
all_product_url = "https://seller.shopee.co.id/portal/product/list/all"
if login(username_email, password, driver):
driver.get(all_product_url)
WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.CLASS_NAME, "list-panel")))
next_page = driver.find_element(by=By.XPATH, value="//button[@class='shopee-button shopee-button--small shopee-button--frameless shopee-button--block shopee-pager__button-next']")
prev_page = driver.find_element(by=By.XPATH, value="//button[@class='shopee-button shopee-button--small shopee-button--frameless shopee-button--block shopee-pager__button-prev']")
# If login success, mobile verification is required.
# print("OTP sent in your mobile number, please wait for it to be received.")
# print("Enter verification code sent in your mobile number:")
# mobile_verification_number = input("> ")
#
# print("Verifying OTP...")
# mobile_verification(mobile_verification_number, driver)
# print("OTP correct, please wait...")
except Exception as exp:
print("An error has occured.")
print(str(exp))
finally:
print("Program Ended.")
driver.close()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# print_hi('PyCharm')
main()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/