0

Syntax to declare driver in Selenium is

Webdriver driver = new.firefoxdriver()

Is there any other way to declare driver. The syntax will open the firefox browser. I am trying to declare driver without opening browser.

Stephen Rauch
  • 44,696
  • 30
  • 102
  • 125
user18160
  • 23
  • 7

1 Answers1

0

You can declare like this

wd=webdriver.Firefox()

but this will also launch the browser as selenium is designed to work in a web browser, but if you want to test something without launching the browser you can use HTMLUnitDriver, which is a headless browser and used to run test cases without actually launching the browser.

Sajal Singh
  • 325
  • 1
  • 9
  • 14