DevOps | Software Automation | Continuous Integration

Tag: Headless

How To Set Up Headless Selenium in C#

 

  1. Install Java
  2. Install Selenium Server
  3. Open Windows command prompt and set Java path:
          set path=C:Program FilesJavajdkbin
 
    4.  Run Selenium Server:
         java -jar selenium-server.jar
 
    5.  Initialise the driver:
 
         IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HTMLUnit());
 
    6.  Continue with the code as usual:
 
         driver.Navigate().GoToUrl(“http://www.google.com”)

Headless Cucumber

I get to set up a CI box that is running on a Linux environment with no display. Therefore, Headless Cucumber is the solution.

Under “features/support”, in “env.rb”, add the following piece of code:

require ‘headless’
   headless = Headless.new
   headless.start 


at_exit do
  headless.destroy
end

© 2023 Chuan Chuan Law

Theme by Anders NorenUp ↑