Reputation: 1
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
Upvotes: 0
Views: 187
Reputation: 1
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");
}
}
}
}
Upvotes: 0