Running Selenium Headless Tests on Outlook shows older version of outlook on Edge chromium browser

Manikandan Suresh 21 Reputation points
2021-12-08T05:15:57.18+00:00

When I run selenium headless tests on outlook , the outlook UI chosen is an different version than running test in an non-headless mode in outlook using selenium c#. I also ran the test using chrome headless mode but it didn't attach the screen shot for the failed tests , but edge chromium has attached the screen shot for this failed test.

Packages & versions:

  1. Selenium.Webdriver - v-4.1.0
  2. Selenium.Support - v-4.1.0
  3. Ms Edge browser version - 96.0.4664.

Steps to Reproduce :
Pre-requisites: Edge chromium browser , and the above mentioned packages.

  1. Try to login in to your outlook account using selenium in non headless mode , and click new message button, you'll able to see the current version of outlook is chosen.
  2. Add --headless option in your edge browser option and try to run the same test to click the new message button , it will fail the test , since the UI is changed and the locators is also been changed.

Headless version
155767-image.png

Expected default version thats currently used
155798-image.png

Microsoft Edge | Microsoft Edge development
Developer technologies | C#
{count} votes

Accepted answer
  1. Anonymous
    2021-12-20T01:56:28.403+00:00

    Hi @Manikandan Suresh

    The issue is due to Edge using an older version of browser in headless mode. You can override the user-agent by adding the user-agent argument user-agent=User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.57 to fix the issue.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    Regards,
    Yu Zhou


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.