emre-gon / Selenium.WebDriver.UndetectedChromeDriver

GNU General Public License v3.0
62 stars 18 forks source link

How to start using? #18

Open guilhermelim opened 1 year ago

guilhermelim commented 1 year ago

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 ```cpp 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

gqchishti commented 1 year ago

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

guilhermelim commented 1 year ago

That sad. It looks like that repository is broken.