【问题标题】:Selenium automation project is working on localhost but not working productionSelenium 自动化项目正在本地主机上工作,但无法生产
【发布时间】:2019-08-02 14:54:00
【问题描述】:

这是我的代码。我使用了 nuget 包 selenium、chrome 驱动器和 chrome 驱动器 exe。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace selenium
{
    class Program
    {
        static void Main(string[] args)
        {
            IWebDriver driver = new ChromeDriver();
            driver.Navigate().GoToUrl("https://www.google.com");
            driver.FindElement(By.Name("q")).SendKeys("test");
        }
    }
}

【问题讨论】:

  • not working的定义是什么?
  • 项目没有出现任何错误,我也使用 try catch。

标签: c# asp.net selenium


【解决方案1】:

您需要启用日志并检查它们。可能的问题是浏览器无法启动(例如 Chrome 和 ChromeDriver 未安装/配置)。另一种可能性是传出的互联网流量被阻止,这通常发生在生产服务器上。

【讨论】:

    猜你喜欢
    • 2018-08-01
    • 1970-01-01
    • 2020-08-16
    • 1970-01-01
    • 2020-04-20
    • 1970-01-01
    • 2015-04-26
    • 1970-01-01
    相关资源
    最近更新 更多