Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
how navigate Page to new link using Selenium webdriver C#.
Vsd Vsd
7y
902
1
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);
}
}
}
}
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 ?