|
Rank: Member Groups: Member
Joined: 4/17/2016 Posts: 11
|
We want to simulate the user login process by sending key stokes, but it works randomly or even stop working in middle.
We have tried to set value through javascript (EvalScript) but it changes as soon as focus is lost from the input field.
Attaching project for your quick investigations. Project Name = WMLogin
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,201
|
Hi, SendKey is not reliable because it depends on focus. Try to use EvalScript this way:
Code: C#
webView1.EvalScript("document.getElementsByName('email')[0].value = 'test123@gmail.com';");
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/17/2016 Posts: 11
|
We want to simulate the user login process by sending key stokes, but it works randomly or even stop working in middle.
We have tried to set value through javascript (EvalScript) but it changes as soon as focus is lost from the input field.
Attaching project for your quick investigations. Project Name = WMLogin
Thanks.
|
|
Rank: Member Groups: Member
Joined: 4/17/2016 Posts: 11
|
Hi,
We have tried this before implementing send keys. The issue is that it does set the value visually however the moment we focus next control i.e. password. The email got reverted to its old value. It doesn't retain the value set by suggested way.
Please advise further.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,201
|
If it does not work with EvalScript, then it won't work with SendKey either. The root of the problem is probably some code in your webpage trying to "restore" the value. So you will need to fix that first. Alternatively, you can use LoadRequest to load a HTTP post request with the username/password value directly without having to fill in the form at all.
|
|
Rank: Member Groups: Member
Joined: 4/17/2016 Posts: 11
|
Thank you very much your all the help.
|
|
Rank: Newbie Groups: Member
Joined: 2/28/2019 Posts: 1
|
Thanks for the help @eo_support
|
|