New issue
Advanced search Search tips

Issue 801530 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 705916



Sign in to add a comment

Message displayed "Please upgrade to a supported browser" when using headless mode

Reported by 94433...@mail.wit.ie, Jan 12 2018

Issue description

Chrome Version       : 63.0.3239.132
URLs (if applicable) : https://connectonline.asic.gov.au/RegistrySearch/faces/landing/SearchRegisters.jspx?_adf.ctrl-state=auxpjsrjo_91
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox:Fail 57.0.1
       Edge:

What steps will reproduce the problem?
(1) Run this C# code to scrape website

ChromeOptions options = new ChromeOptions();
           
options.AddArgument("--headless");
options.AddArgument("--window-size=1366x768");
options.AddArgument("--disable-gpu");
            

using (IWebDriver driver = new ChromeDriver(options))
{
                
 driver.Navigate().GoToUrl("https://connectonline.asic.gov.au/RegistrySearch/faces/landing/SearchRegisters.jspx?_adf.ctrl-state=auxpjsrjo_91");
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));

 var selectWithin = driver.FindElement(By.CssSelector("#bnConnectionTemplate\\3a 
 pt_s5\\3a templateSearchTypesListOfValuesId\\3a \\3a content"));
 var selectElement = new SelectElement(selectWithin);
 selectElement.SelectByValue("1");

 Thread.Sleep(2000);

 IWebElement query;
 query = wait.Until<IWebElement>(d => d.FindElement(By.CssSelector("#bnConnectionTemplate\\3a pt_s5\\3a templateSearchInputText\\3a \\3a content")));
 query.SendKeys(searchString);

 IWebElement search;
 search = wait.Until<IWebElement>(d => d.FindElement(By.CssSelector("#bnConnectionTemplate\\3a pt_s5\\3a searchButtonId")));
 search.Click();

 //Take screenshot
 Thread.Sleep(10000);
 Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot();

 string screenshot = ss.AsBase64EncodedString;
 byte[] screenshotAsByteArray = ss.AsByteArray;
 ss.SaveAsFile("C:\\Users\\Sean\\Documents\\screenshot.jpg", 
 ScreenshotImageFormat.Jpeg); //use any of the built in image formating
}

(2) Open screenshot.jpg file
(3)

What is the expected result?

See Attached file screenshot_without_headless.jpg.
This was created without using headless mode.

What happens instead?

See attached file screenshot.jpg

A message is displayed in the top right hand corner - "Please upgrade to a supported browser".


Please provide any additional information below. Attach a screenshot if
possible.

 
screenshot_without_headless.jpg
107 KB View Download
screenshot.jpg
139 KB View Download
Status: WontFix (was: Unconfirmed)
I suspect the site is checking the browser's user agent, which is different in headless mode by default. Try using the --user-agent to switch to a standard user agent.
That worked, Thank you

Sign in to add a comment