Skip to content

Commit 57b762d

Browse files
ChromeOptions & Headless Mood execution
1 parent f8f13f9 commit 57b762d

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

PythonSelenium/AutomationPractice4.py

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@
5050
ActualList.append(data.text)
5151

5252
assert ExpectedList == ActualList
53+
54+
#taking screenshots
55+
driver.get_screenshot_as_file("products")

PythonSelenium/ChromeOptions.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import time
2+
from selenium import webdriver
3+
from selenium.webdriver.chrome.service import Service
4+
5+
chrome_options = webdriver.ChromeOptions()
6+
# how to run browser in headless mood
7+
chrome_options.add_argument("headless")
8+
9+
# how to ignore certification errors
10+
chrome_options.add_argument("--ignore-certificate-errors")
11+
12+
# Maximize screen mood
13+
chrome_options.add_argument("--start-maximized")
14+
15+
16+
17+
# Chrome browser invoke by driver through manually
18+
service_obj = Service("C:\\Users\\Proshanta\\Desktop\\PythonAutomation\\driver\\chromedriver.exe")
19+
driver = webdriver.Chrome(service=service_obj, options=chrome_options)
20+
21+
driver.get("https://rahulshettyacademy.com/seleniumPractise/#/")
22+
print(driver.title)
23+
time.sleep(5)

PythonSelenium/HeadlessMoodSetup.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import time
2+
from selenium import webdriver
3+
from selenium.webdriver.chrome.service import Service
4+
5+
chrome_options = webdriver.ChromeOptions()
6+
# how to run browser in headless mood
7+
chrome_options.add_argument("headless")
8+
9+
# how to ignore certification errors
10+
chrome_options.add_argument("--ignore-certificate-errors")
11+
12+
# Chrome browser invoke by driver through manually
13+
service_obj = Service("C:\\Users\\Proshanta\\Desktop\\PythonAutomation\\driver\\chromedriver.exe")
14+
driver = webdriver.Chrome(service=service_obj, options=chrome_options)
15+
16+
driver.get("https://rahulshettyacademy.com/seleniumPractise/#/")
17+
driver.maximize_window()
18+
time.sleep(5)
19+
20+
# how to copy one list to another
21+
List = ['1', '2', '3']
22+
CopyList = List.copy()

0 commit comments

Comments
 (0)