【问题标题】:can't access google with automation selenium c#无法使用自动化 selenium c# 访问谷歌
【发布时间】:2021-01-03 05:21:22
【问题描述】:

我是新手,我正拼命尝试使用 Selenium Chrome 网络驱动程序在 youtube 上上传视频,但是当我尝试登录我的谷歌帐户时,它阻止我这样做,因为 Chrome 识别该过程是自动化的。它给我的错误是关于浏览器不安全。

有人知道如何避免这个问题,或者如何在我的帐户已登录或任何其他建议的情况下打开 chrome?

options.AddArgument("--start-maximized");

options.AddArguments("--disable-web-security", "--disable-gpu", "--incognito", "--proxy-bypass-list=*", "--proxy-server='direct://'", "--log-level=3", "--hide-scrollbars");

//options.AddArgument("user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0'");

IWebDriver driver = new ChromeDriver(options);

driver.Manage().Cookies.DeleteAllCookies();
driver.Manage().Window.Maximize();
//driver.Url = ("https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1#identifier");
driver.Url = "https://www.google.com/";

【问题讨论】:

标签: c# selenium-webdriver


【解决方案1】:

这里有一个解决方法:

  • 第一次运行脚本时

  • 转到 Stackoverflow(或其他有 google 的网页 身份验证)使用您的 Google 帐户登录

  • 转到您想要的页面 - 您已登录您的 Google 帐户

第一步您必须执行一次 - 之后您将在 Chrome 浏览器中登录 Google。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多