- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- 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 −
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()
- 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?