user1504725
user1504725

Reputation: 17

Cant Launch a window with Selenium Chrome Driver c#

Environment: Vs2019, C# NuGet Package: Selenium v3.141.0 by Selenium Committee. Chrome Driver from Selenium website - v92.0

IWebDriver Driver = new ChromeDriver("FolderPath"); //time out error here. Driver.url = "www.google.com"

with no other code, I can't get pass declaring Chrome Driver. I get a time out error with local host. I tried: setting a different port. adding "no-sandbox" to arguments.

Upvotes: 0

Views: 759

Answers (2)

user1504725
user1504725

Reputation: 17

I need to add a chrome option:

ChromeOptions options = new ChromeOptions()
options.add("--remote-debugging-port=9222 ") // change port if necessary

Upvotes: 0

damiensprinkle
damiensprinkle

Reputation: 156

I would try utilizing the ChromeDriver NuGet package instead of pointing to a local file location https://www.nuget.org/packages/Selenium.WebDriver.ChromeDriver/

Here is a simple example for you to reference

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;


namespace ExampleDemo
{
    [TestFixture]
    public class Chrome_test
    {
        private IWebDriver driver;

        [Test(Description="Go To Google")]
        public void GoToGoogle() {

            homeURL = https://www.google.com/;
            driver.Navigate().GoToUrl(homeURL);
        }

        [TearDown]
        public void TearDownTest()
        {
            driver.Close();
        }

        [SetUp]
        public void SetupTest()
        {
            driver = new ChromeDriver();
        }
    }
}

Upvotes: 2

Related Questions