Instantly share code, notes, and snippets.

Embed
What would you like to do?
using OpenQA.Selenium;
using OpenQA.Selenium.Edge;
using System;
namespace EdgeDriverTests
{
public class Program
{
/*
* This assumes you have added MicrosoftWebDriver.exe to your System Path.
* For help on adding an exe to your System Path, please see:
* https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx
*/
static void Main(string[] args)
{
/* You can find the latest version of Microsoft WebDriver here:
* https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
*/
var driver = new EdgeDriver();
// Navigate to Bing
driver.Url = "https://www.bing.com/";
// Find the search box and query for webdriver
var element = driver.FindElementById("sb_form_q");
element.SendKeys("webdriver");
element.SendKeys(Keys.Enter);
Console.ReadLine();
driver.Quit();
}
}
}
@cocasio

This comment has been minimized.

Show comment
Hide comment
@cocasio

cocasio Aug 24, 2015

Using Edge Browser 20.10240.16384.0 : WebDriver 10.0.10240.0 this code generate an error: An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code
Additional information: The HTTP request to the remote WebDriver server for URL
http://localhost:51421/session timed out after 60 seconds.

cocasio commented Aug 24, 2015

Using Edge Browser 20.10240.16384.0 : WebDriver 10.0.10240.0 this code generate an error: An exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll but was not handled in user code
Additional information: The HTTP request to the remote WebDriver server for URL
http://localhost:51421/session timed out after 60 seconds.

@ramnarayan1

This comment has been minimized.

Show comment
Hide comment
@ramnarayan1

ramnarayan1 Sep 24, 2015

using OpenQA.Selenium.Edge;

do u mean 'import org.openqa.selenium.Edge;' Edge class is not there in the package sir ...

and when i copy the code 'System.Environment.Is64BitOperatingSystem' : Environment is also not defined ..

Please help me to execute my first test in edge....

ramnarayan1 commented Sep 24, 2015

using OpenQA.Selenium.Edge;

do u mean 'import org.openqa.selenium.Edge;' Edge class is not there in the package sir ...

and when i copy the code 'System.Environment.Is64BitOperatingSystem' : Environment is also not defined ..

Please help me to execute my first test in edge....

@andyrblank

This comment has been minimized.

Show comment
Hide comment
@andyrblank

andyrblank Sep 30, 2015

@cocasio Change the Edge home page to an actual page (ie. http://google.com) instead of the default "Start page" option. I struggled with this for a bit. I suppose it's because the driver requests a session and since there's no page loaded there isn't a session and it hangs.

andyrblank commented Sep 30, 2015

@cocasio Change the Edge home page to an actual page (ie. http://google.com) instead of the default "Start page" option. I struggled with this for a bit. I suppose it's because the driver requests a session and since there's no page loaded there isn't a session and it hangs.

@lixunrui

This comment has been minimized.

Show comment
Hide comment
@lixunrui

lixunrui Dec 17, 2015

Im having the same problem as Cocasio had, also tried to change the default page to a actual page, but sill no luck, shows an error: No such driver, do you have any clue on this one?

lixunrui commented Dec 17, 2015

Im having the same problem as Cocasio had, also tried to change the default page to a actual page, but sill no luck, shows an error: No such driver, do you have any clue on this one?

@InstyleVII

This comment has been minimized.

Show comment
Hide comment
@InstyleVII

InstyleVII Apr 6, 2016

Updated the gist, give it a try now

Owner

InstyleVII commented Apr 6, 2016

Updated the gist, give it a try now

@VamshidharRaoKotha

This comment has been minimized.

Show comment
Hide comment
@VamshidharRaoKotha

VamshidharRaoKotha Apr 13, 2016

What Cocasio has got error, still same error is getting for me. The alternative way to invoke edge browser is:
1)run microsoftwebdriver.exe in a cmd prompt
2)IWebDriver driver =null;
desiredCapabilities = DesiredCapabilities.Edge();
driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), desiredCapabilities);

And then you can write navigate, click all statements. this works for me. But for the above error microsoft team should show us a solution.

VamshidharRaoKotha commented Apr 13, 2016

What Cocasio has got error, still same error is getting for me. The alternative way to invoke edge browser is:
1)run microsoftwebdriver.exe in a cmd prompt
2)IWebDriver driver =null;
desiredCapabilities = DesiredCapabilities.Edge();
driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), desiredCapabilities);

And then you can write navigate, click all statements. this works for me. But for the above error microsoft team should show us a solution.

@deepeshverma

This comment has been minimized.

Show comment
Hide comment
@deepeshverma

deepeshverma Oct 20, 2016

Hello,

I am getting driver as null on "driver = new EdgeDriver(serverPath, options)", not sure what is causing the issue. Edge is opened and then I get the error. In Catch statement I get "unknown error".

Quick help will be appreciated.

Thanks,
Deepesh Verma

deepeshverma commented Oct 20, 2016

Hello,

I am getting driver as null on "driver = new EdgeDriver(serverPath, options)", not sure what is causing the issue. Edge is opened and then I get the error. In Catch statement I get "unknown error".

Quick help will be appreciated.

Thanks,
Deepesh Verma

@deepeshverma

This comment has been minimized.

Show comment
Hide comment
@deepeshverma

deepeshverma Oct 20, 2016

Sorry, I have fixed the issue, was using incorrect web driver for edge

Thanks,
Deepesh Verma.

deepeshverma commented Oct 20, 2016

Sorry, I have fixed the issue, was using incorrect web driver for edge

Thanks,
Deepesh Verma.

@ralucasuditu

This comment has been minimized.

Show comment
Hide comment
@ralucasuditu

ralucasuditu Feb 4, 2017

hi, how to we set
'browser.download.dir': DOWNLOAD_ABSOLUTEPATH,
'prompt_for_download': false

in a protractor config file for edge driver?

ralucasuditu commented Feb 4, 2017

hi, how to we set
'browser.download.dir': DOWNLOAD_ABSOLUTEPATH,
'prompt_for_download': false

in a protractor config file for edge driver?

@InstyleVII

This comment has been minimized.

Show comment
Hide comment
@InstyleVII

InstyleVII Aug 7, 2017

I've updated the public gist to no longer require RemoteWebDriver and be a simpler example.

Owner

InstyleVII commented Aug 7, 2017

I've updated the public gist to no longer require RemoteWebDriver and be a simpler example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment