My Winform contails
Two TextBoxes
1)txtUserName
2)txtPassword
and 1 Button object
1)btnLogin
I just want to transfer winform txtUserName and txtPassword data to My Yahoo login page while click on btnLogin.
I achived this thing for IE but now I want to do for other Web Browser like Chrome
I search it on google but i didnt get any help for this. please if you know how to do this so please guide me.
Thankx in Advance
I solve my issue after spending long time over it. This code open the chrome browser and transfer your winform data to chrome browser.
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsChrome
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// download the chrome driver
IWebDriver driver = new ChromeDriver(@"C:\Users\Downloads\chromedriver");
driver.Navigate().GoToUrl("http://www.yahoo.com");
IWebElement myField = driver.FindElement(By.Id("txtUserName"));
myField.SendKeys("UserName");
IWebElement myField = driver.FindElement(By.Id("txtPassword"));
myField.SendKeys("Password");
IWebElement myField = driver.FindElement(By.Id("btnLogin"));
myField.click()
}
}
}
if you want to transfer tour data to other browser you just change the driver for respecctive browser i will work.