I use WebDriver.

<https://github.com/dom96/webdriver>

I want to start firefox headless. Is this possible?

I wrote the following code, and Firefox comes up with a GUI.
    
    
    import webdriver
    import os, osproc
    
    when isMainModule:
      let currentPath = getCurrentDir()
      let outp = startProcess(currentPath / "geckodriver.exe", "")
      echo "awake: ", currentPath / "geckodriver.exe"
      echo repr(outp)
      
      var wDriver = newWebDriver()
      var session = wDriver.createSession()
      
      session.navigate("https://example.com";)
    
    
    Run

So, adding --headless to startProcess would result in an error.
    
    
    import webdriver
    import os, osproc
    
    when isMainModule:
      let currentPath = getCurrentDir()
      let outp = startProcess(currentPath / "geckodriver.exe", "", 
["--headless"])
      echo "awake: ", currentPath / "geckodriver.exe"
      echo repr(outp)
      
      var wDriver = newWebDriver()
      var session = wDriver.createSession()
      
      session.navigate("https://example.com";)
    
    
    Run

Is there any way? Please let me know if you know.

Thank you.

Reply via email to