0

I am executing the C# program for Mozilla Firefox using Selenium grid on Visual Studio. Installed the necessary NuGet packages. When I run the application it is throwing this error.

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using System.Threading;
using System.Drawing;

namespace Test
{
    class Firefoxgrid
    {
        static void Main(string[] args)
        {
            RemoteWebDriver driver;


            //FIREFOX example testing with version 70 on Linux         
            FirefoxOptions Options = new FirefoxOptions();

            Options.BrowserExecutableLocation = "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";
                                                                                // Options.PlatformName = "windows"; // exclude for linux
            Options.AddAdditionalCapability("platform", "LINUX", true); // Supported values: "VISTA" (Windows 7), "WIN8" (Windows 8), "WIN8_1" (windows 8.1), "WIN10" (Windows 10), "LINUX" (Linux)
            Options.AddAdditionalCapability("version", "70", true); // for Chrome only, you can specify version=latest or the real version number like version=74. For Firefox and IE you must always specify the version number.
        //Options.AddAdditionalCapability("gridlasticUser", USERNAME, true);
          //  Options.AddAdditionalCapability("gridlasticKey", ACCESS_KEY, true);
            Options.AddAdditionalCapability("video", "True", true);


            driver = new RemoteWebDriver(
              new Uri("https://www.youtube.com/"), Options.ToCapabilities(), TimeSpan.FromSeconds(600));// NOTE: connection timeout of 600 seconds or more required for time to launch grid nodes if non are available.
            try
            {
                driver.Manage().Window.Maximize(); // WINDOWS, DO NOT WORK FOR LINUX/firefox. If Linux/firefox set window size, max 1920x1080, like driver.Manage().Window.Size = new Size(1920, 1080);
               // driver.Manage().Window.Size = new Size(1920, 1080); // LINUX/firefox           
                driver.Navigate().GoToUrl("https://www.google.com/ncr");
                IWebElement query = driver.FindElement(By.Name("q"));
                query.SendKeys("webdriver");
                query.Submit();
            }
            finally
            {
                Console.WriteLine("Video: " + "https://www.youtube.com/watch?v=m2-VleiytP8" + driver.SessionId);
                driver.Quit();
            }
        }
    }
}

OpenQA.Selenium.WebDriverException: 'Unexpected error.'

 <!DOCTYPE html><html><head><style>* { margin:0;padding:0;border:0}html,body{height:100%;}</style><title>404 Not Found</title>
<!-- handler: vanity_404handler -->
                                                                                                                                                                               </head><body><iframe style="display:block;border:0;" src="/error?src=404&amp;ifr=1&amp;error=" width="100%" height="100%" frameborder="0" scrolling="no"></iframe></body></html>'
Sk1993
  • 11
  • 2

0 Answers0