I'm trying to figure out how to auto fill two text box's located on a website embedded in my windows form via two text box's also on my windows form. The Id of one of the text box's is Email. The other textbox's Id is Password. I know I can find the element Id of the text box's on the embed browser in my windows form by using this code below. I will post the definition first.
public void ExecuteScriptAsync(string script);
This is the code used to get the Id.
browser.ExecuteScriptAsync("document.getElementById('Email')")
browser.ExecuteScriptAsync("document.getElementById('Password')")
Which in turn I can set the value/text of said text box's by using this code. The below code works great and will set the value/text of both text box's.
browser.ExecuteScriptAsync("document.getElementById('Email').value= 'USER EMAIL STRING'");
browser.ExecuteScriptAsync("document.getElementById('Password').value= 'USER PASSWORD STRING'");
I have two text boxes on my windows form named txtEmail and txtPassword that I would like to use so the user can put his or her own login information. I tried to achieve this among other ways by passing the txtEmail.Text and txtPassword.Text in the code below which doesn't work.
string Email = @"""document.getElementById('Email').value= " + @"'" + txtEmail.Text + @"'""";
string Password = @"""document.getElementById('Password').value= " + @"'" + txtPassword.Text + @"'""";
browser.ExecuteScriptAsync(Email);
browser.ExecuteScriptAsync(Password);
I don't get any errors inside the developer IDE. It just won't set the text box's text in the embedded browser. Can someone explain how to use a text box on my windows form to pass along the needed strings?
Edit: Reworded the question in better detail. Hope it better helps explain my question.