-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_bot_for_traffic
More file actions
85 lines (55 loc) · 1.96 KB
/
python_bot_for_traffic
File metadata and controls
85 lines (55 loc) · 1.96 KB
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
85
from __future__ import print_function
import pickle
import os.path
from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
from oauth2client.tools import argparser
import pandas as pd
import numpy as np
import datetime as dt
import requests
import shutil
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.common.exceptions import ElementClickInterceptedException
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import time
import pyautogui
opt = Options()
# opt.add_argument('--headless')
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
opt.add_experimental_option("prefs", {\
"profile.default_content_setting_values.notifications":1
})
# Initiate the browser
# driver = webdriver.Chrome(r"./Applications/Google Chrome.app")
driver = webdriver.Chrome(ChromeDriverManager().install(),chrome_options=opt)
driver.get("https://www.google.com")
time.sleep(3)
search_bar = driver.find_elements_by_class_name("gLFyf.gsfi")
search_bar[0].send_keys("Stanza living")
search_bar[0].submit()
time.sleep(2)
page = driver.find_elements_by_class_name("LC20lb.MBeuO.DKV0Md")
page[0].click()
time.sleep(4)
close_popup = driver.find_elements_by_class_name("close-icon-container")
close_popup[0].click()
time.sleep(10)
# driver.quit()
# Xmen_urls = driver.find_elements_by_class_name('iUh30')
# link = driver.find_element_by_link_text("Stanza Living - Your Second Home in a new city.")
# link.click()
# close_popup = driver.find_elements_by_class_name("close-icon-container")
# close_popup[0].click()
# time.sleep(2)
# first_click = driver.find_element_by_link_text("Explore Residences")
# first_click.click()
# time.sleep(10)
# driver.quit()