Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
how navigate Page to new link using Selenium webdriver C#.
Vsd Vsd
Sep 20 2016 5:38 AM
888
Reply
Now i want to redirect the my current page to check new form of family details form so how can i do this
HTML code for family details link is
<
a
href
=
"/Admin/CountryMaintenanace"
>
<
span
>
Maintenance
</
span
>
</
a
>
using
System.IO;
using
System.Text;
using
OpenQA.Selenium;
using
OpenQA.Selenium.Chrome;
using
OpenQA.Selenium.Support.UI;
using
System.Drawing.Imaging;
namespace
eulogin
{
class
Program
{
static
void
Main(
string
[] args)
{
// Initialize the Chrome Driver
using
(var driver =
new
ChromeDriver(@
"C:\Users\v.dusane\Documents\Visual Studio 2012\Projects\ToolsQA"
))
{
// Go to the home page
driver.Navigate().GoToUrl(
"http://localhost:36000/login"
);
// Get the page elements
driver.FindElement(By.Id(
"UserName exampleInputEmail2"
)).SendKeys(
"Admin"
);
driver.FindElement(By.Id(
"Pwd exampleInputPassword2"
)).SendKeys(
"Admin@123"
);
driver.FindElement(By.Id(
"logid"
)).Click();
driver.FindElement(By.LinkText(
"/Admin/CountryMaintenanace"
)).Click();
// Take a screenshot and save it into screen.png
driver.GetScreenshot().SaveAsFile(@
"screen.png"
, ImageFormat.Png);
}
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
What is the difference between ‘/’ and ‘//’ in selenium ?
What are the changes updated in selenium 3.0 ?