-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplication_Commands.py
30 lines (21 loc) · 1.02 KB
/
Application_Commands.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
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
# Creating an object for Options
chrome_options = Options()
# This will resolve the error if chrome browser is closing automatically after opening.
chrome_options.add_experimental_option("detach", True)
# This will create an object for Service where we need to provide the chromedriver.exe path
sev_obj = Service("E:\Drivers\chromedriver_win32\chromedriver.exe")
# This will open chrome browser
driver = webdriver.Chrome(service=sev_obj,options=chrome_options)
# This will maximize browser window.
driver.maximize_window()
# This GET command will open facebook.
driver.get("https://facebook.com/")
# This TITLE command will print the title of current page
print(driver.title)
# This CURRENT_URL command will print the currnet url which is opend
print(driver.current_url)
# This PAGE_SOURCE command will show the source code of current page.
print(driver.page_source)