51Testing软件测试论坛

标题: Chrome headless 下访问maxbet(https网站),显示错误,不知道是不是证书原因 [打印本页]

作者: 测试积点老人    时间: 2019-8-13 09:34
标题: Chrome headless 下访问maxbet(https网站),显示错误,不知道是不是证书原因
Chrome headless ,无论是在命令行模式,还是代码模式下,访问https://www.maxbet.com网站,得到的html都为空
c#代码如下:
  1. ChromeOptions options = new ChromeOptions();
  2.             options.AddArgument("headless");
  3.             options.AddArgument("disable-gpu");
  4.             options.AddArgument("no-sandbox");
  5.             //options.AddArgument("window-size=0,0");
  6.             //options.AddArgument("window-position=-200,-200");
  7.             //options.AddArguments("--ignore-certificate-errors", "--disable-dev-shm-usage");
  8.             options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true, true);
  9.             options.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true, true);
  10.             options.AddArguments("--test-type", "--ignore-certificate-errors", "--disable-dev-shm-usage");
  11.             options.AddUserProfilePreference("profile.default_content_setting_values.images", 2);

  12.             var driver = new ChromeDriver(options);
  13.             driver.Url = "https://www.maxbet.com/";
  14.             Console.WriteLine("html:" + driver.PageSource);
  15. --------------------------------------------------------------------
  16. <html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
复制代码
在命令行模式下,使用 chrome --headless --disable-gpu --enable-logging --dump-dom https://www.maxbet.com 结果一样。知道的解答一下,谢谢。

作者: 海海豚    时间: 2019-8-14 10:13
应该是证书的问题
作者: qqq911    时间: 2019-8-14 10:42
贴下日志
作者: jingzizx    时间: 2019-8-14 13:03
试试其他方式
作者: 104~牛牛    时间: 2019-8-14 15:26

fiddler试试




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2