Click Here to Download OpenWebsiteInBrowserUsingSeleniumWebDriver.zip
You can easily open any URL in browser automatically with selenium C# WebDriver. This is first and basic step of any WebSite testing and make to do automate WebSite running.
For this we are using 'Navigate' method and 'URL' property of WebDriver Browser class object.
Here you are learning open WebSite or URL with selenium C# WebDriver.
First, you need to create object of any browser in which you need to open WebSite or URL. You can create object of FireFox, Internet Explorer, Chrome, etc.
After creating object, you need call 'Navigate' method and then set WebSite URL which you need to open into 'URL' property.
Here is example for this.
In this example we are opening 'http://www.google.com' WebSite in FireFox web browser using selenium C# WebDriver.
In this example first we create object of FireFox driver after that, we need to call 'Navigate' method and then we need to set URL property with 'http://www.google.com'. So this code open the 'www.google.com' WebSite in FireFox web browser.
For sample page. Now we take one page and place one button name it like 'Open Website' and on click of button you need to write below code.
Now, you can see in below images to open WebSite.
[Image : Click on 'Open WebSite' Button] :
[Image : FireFox is open with 'http://www.google.com' website] :
This same code is used to open WebSite in other web browser like Internet Explorer, Chrome, etc. Only you need to create object of that WebDriver.
Here are the links for How to open Internet Explorer and Chrome web browser.
Full Video :
Note :
If any runtime error occurred by running our downloaded project meaning
of that your browser version and Selenium API DLL version is not
matching. To resolve this issue you need to download latest Selenium C#
API DLLs from this link and paste downloaded DLLs into 'Bin'
folder of downloaded project. Or you can remove references of existing
DLLs references and add new DLLs references. You can learn this thing
from this link.
You can easily open any URL in browser automatically with selenium C# WebDriver. This is first and basic step of any WebSite testing and make to do automate WebSite running.
For this we are using 'Navigate' method and 'URL' property of WebDriver Browser class object.
Here you are learning open WebSite or URL with selenium C# WebDriver.
First, you need to create object of any browser in which you need to open WebSite or URL. You can create object of FireFox, Internet Explorer, Chrome, etc.
After creating object, you need call 'Navigate' method and then set WebSite URL which you need to open into 'URL' property.
Here is example for this.
In this example we are opening 'http://www.google.com' WebSite in FireFox web browser using selenium C# WebDriver.
In this example first we create object of FireFox driver after that, we need to call 'Navigate' method and then we need to set URL property with 'http://www.google.com'. So this code open the 'www.google.com' WebSite in FireFox web browser.
For sample page. Now we take one page and place one button name it like 'Open Website' and on click of button you need to write below code.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Selenium; using OpenQA; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnOpenWebsite_Click(object sender, EventArgs e) { OpenQA.Selenium.Firefox.FirefoxDriver objFF = new OpenQA.Selenium.Firefox.FirefoxDriver(); objFF.Navigate(); objFF.Url = "http://www.google.com"; } }
Now, you can see in below images to open WebSite.
[Image : Click on 'Open WebSite' Button] :
(To view original size image , click on image) |
[Image : FireFox is open with 'http://www.google.com' website] :
(To view original size image , click on image) |
This same code is used to open WebSite in other web browser like Internet Explorer, Chrome, etc. Only you need to create object of that WebDriver.
Here are the links for How to open Internet Explorer and Chrome web browser.
Full Video :
No comments:
Post a Comment