Selenium.WebDriver.UndetectedChromeDriver icon indicating copy to clipboard operation
Selenium.WebDriver.UndetectedChromeDriver copied to clipboard

How to start using?

Open guilhermelim opened this issue 3 years ago • 2 comments

Please someone give me an example of how to start. I'm getting errors and have no idea how to start. Can anyone suggest a code to get started that works?

My Code
using OpenQA.Selenium.Chrome;
using Selenium.WebDriver.UndetectedChromeDriver;
using Sl.Selenium.Extensions.Chrome;
using System.Reflection;
namespace Botnet
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ChromeOptions options = new ChromeOptions();
            options.BinaryLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\ChromeDrivers\undetected_chromedriver.exe";
            UndetectedChromeDriver.ENABLE_PATCHER = true;

            using (var driver = UndetectedChromeDriver.Instance("profile_name", options, TimeSpan.FromSeconds(10)))
            {
                driver.GoTo("https://nowsecure.nl");
                driver.RandomWait(5, 7);

                if (driver.GetTextOf("h1") == "OH YEAH, you passed!")
                {
                    Console.WriteLine("OH YEAH, you passed!");
                }
                else
                {
                    Console.WriteLine("Did not work!");
                }
            }

            Console.ReadLine();
        }
    }
}

image

Error:
OpenQA.Selenium.WebDriverException: 'unknown error: Chrome failed to start: was killed.
(unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location
C:\Users\guilh\OneDrive\Projetos\.NET\bot-net\bot-net\bin\Debug\net6.0\ChromeDrivers\undetected_chromedriver.exe
is no longer running, so ChromeDriver is assuming that Chrome has crashed.)'

image

guilhermelim avatar Dec 07 '22 10:12 guilhermelim

I added both chrome and chromedriver to PATH and then just using UndetectedChromeDriver.Instance() worked but it is still getting detected.

gqchishti avatar Dec 18 '22 03:12 gqchishti

That sad. It looks like that repository is broken.

guilhermelim avatar Dec 19 '22 16:12 guilhermelim