0

It gives me this error of the chromedriver.exe does not exists after using the selenium packages. Please let me know what is the issue. I have also followed the instructions as told in the dialog box, but the issue persists! Below are some images of my c# code and G1ANT Studio.

C# Code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using G1ANT.Language;

using OpenQA.Selenium;

using OpenQA.Selenium.Chrome;

using OpenQA.Selenium.Firefox;

namespace G1ANT.Addon.YouTube
{
    [Command(Name = "youtube.open", Tooltip = "It opens youtube in a web browser")]
    class OpenCommand : Command
    {
        public OpenCommand(AbstractScripter scripter) : base(scripter)
        {

        }
        public class Arguments : CommandArguments
        {
            [Argument(Name = "browser", Required = true, Tooltip = "Type of browser; For Chrome, type: chrome; For Firefox, type: firefox")]
            public TextStructure Browser { get; set; } = new TextStructure();
        }
        public void Execute(Arguments argument)
        {
            if(argument.Browser.Value == "chrome")
            {
                IWebDriver driver = new ChromeDriver("C:/Users/Krishna/source/repos/G1ANT.Addon.YouTube/packages/Selenium.Chrome.WebDriver.83.0.0/driver/chromedriver");
                driver.Navigate().GoToUrl(@"https://www.youtube.com/");
            }
            else if(argument.Browser.Value == "firefox")
            {
                IWebDriver driver = new FirefoxDriver("C:/Users/Krishna/source/repos/G1ANT.Addon.YouTube/packages/Selenium.Firefox.WebDriver.0.26.0/driver/geckodriver");
                driver.Navigate().GoToUrl(@"https://www.youtube.com/");
            }
            else
            {
                RobotMessageBox.Show("Wrong input" + argument.Browser.Value + "\n For Chrome, type: chrome; For Firefox, type: firefox");
            }
        }
    }
}

Error in G1ANT Studio:

It says the chromedriver.exe does not exist after I run the "youtube.open browser chrome" command in the G1ANT Studio

  • [Don't do this](https://meta.stackoverflow.com/questions/361474/should-we-display-a-warning-when-users-include-images/361481#361481). Please read why a [screenshot of HTML or code or error is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace. – undetected Selenium Jul 16 '20 at 14:46
  • Ok, I have done it! Thank You – Krishna Rajule Jul 17 '20 at 02:15

1 Answers1

0

The answer at this link, was one of, which helped in solving this error!

https://stackoverflow.com/a/51608925/13725510

Secondly, I modified the path, please refer to the code in the question and the following code(Error-solved), the line where path is mentioned:

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

namespace G1ANT.Addon.YouTube
{
    [Command(Name = "youtube.open", Tooltip = "It opens youtube in a web browser")]
    class OpenCommand : Command
    {
        public OpenCommand(AbstractScripter scripter) : base(scripter)
        {

        }
        public class Arguments : CommandArguments
        {
            [Argument(Name = "browser", Required = true, Tooltip = "Type of browser; For Chrome, type: chrome; For Firefox, type: firefox")]
            public TextStructure Browser { get; set; } = new TextStructure();
        }
        public void Execute(Arguments argument)
        {
            if(argument.Browser.Value == "chrome")
            {
                IWebDriver driver = new ChromeDriver("C:/Users/Krishna/source/repos/G1ANT.Addon.YouTube/packages/Selenium.Chrome.WebDriver.83.0.0/driver");
                driver.Navigate().GoToUrl(@"https://www.youtube.com/");
            }
            else if(argument.Browser.Value == "firefox")
            {
                IWebDriver driver = new FirefoxDriver("C:/Users/Krishna/source/repos/G1ANT.Addon.YouTube/packages/Selenium.Firefox.WebDriver.0.26.0/driver");
                driver.Navigate().GoToUrl(@"https://www.youtube.com/");
            }
            else
            {
                RobotMessageBox.Show("Wrong input: " + argument.Browser.Value + "\n For Chrome, type: chrome; For Firefox, type: firefox");
            }
        }
    }
}