- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to trigger headless test execution in Selenium with Python?
Selenium supports headless execution. In the Chrome browser, the headless execution can be implemented with the help of the ChromeOptions class. We have to create an object of this class and apply the add_arguments method to it. Finally, pass the parameter --headless to this method.
Let us obtain the title - About Careers at Tutorials Point - Tutorialspoint of the page launched in a headless mode −
Example
Code Implementation
from selenium import webdriver from selenium.webdriver.chrome.options import Options #object of Options class c = Options() #passing headless parameter c.add_argument("--headless") #adding headless parameter to webdriver object driver = webdriver.Chrome(executable_path='../drivers/chromedriver', options=c) # implicit wait time driver.implicitly_wait(5) # url launch driver.get("https://www.tutorialspoint.com/about/about_careers.htm") print('Page title: ' + driver.title) # driver quit driver.quit()
Output
- Related Articles
- How to make firefox headless programmatically in Selenium with python?
- How test runner prioritize test classes for execution in Selenium?
- Downloading with chrome headless and selenium.
- How to connect to Chromium Headless using Selenium?
- Selenium and Headless Environment.
- How to set delay for MySQL trigger/procedure execution?
- Does Selenium support headless browser testing?
- How can MySQL handle the errors during trigger execution?
- How to exclude a test from execution in Pytest?
- What are assertions available to test relational comparisons in Selenium with python?
- How to skip a selected test from execution in pytest?
- How to overlook a particular test method from execution in TestNG?
- How to skip a particular test method from execution in Cucumber?
- What is the order of test execution with priority in TestNG?
- How to run multiple test cases using TestNG Test Suite in Selenium?

Advertisements