I am not able to launch the ms edge in headless mode from js selenium

Ratnalarao Perugu 21 Reputation points
2021-02-15T13:14:00.417+00:00

Hi Team ,

i am not able to launch the edge in headless mode in js (mocha+ chai) selenium . I am able to launch in non headless mode and it is working as expected . PFB snippet which i am using to launch in headless mode . Am i missing anything here ? Could you please help me out here to launch in headless mode . 88 is my edge version.

edge = require('selenium-webdriver/edge');
headLessMode = true ;
driver = headLessMode ? new webdriver.Builder().withCapabilities(webdriver.Capabilities.edge()).
setEdgeOptions(new edge.Options().addArguments(['--headless','--no-sandbox','--start-maximized','--window-size=1900,1080'])).build() :
new webdriver.Builder().withCapabilities(webdriver.Capabilities.edge()).build();

Thanks ....

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,355 questions
{count} votes

Accepted answer
  1. Deepak-MSFT 2,201 Reputation points Microsoft Vendor
    2021-02-16T09:06:21.147+00:00

    @Ratnalarao Perugu ,
    I suggest you try to set the options like below.

    let options = new edge.Options();   
    options.setEdgeChromium(true);   
    options.addArguments("headless");   
    

    See whether it works.

    ----------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.