Welcome Guest Search | Active Topics | Sign In | Register

Send Keys works Randomly Options
Michael Thompson
Posted: Wednesday, October 19, 2016 4:46:38 AM
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.
eo_support
Posted: Wednesday, October 19, 2016 3:57:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
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!
Michael Thompson
Posted: Wednesday, October 19, 2016 11:10:22 PM
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.
Michael Thompson
Posted: Wednesday, October 19, 2016 11:13:47 PM
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.
eo_support
Posted: Thursday, October 20, 2016 8:08:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,066
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.
Michael Thompson
Posted: Friday, October 21, 2016 12:26:19 AM
Rank: Member
Groups: Member

Joined: 4/17/2016
Posts: 11
Thank you very much your all the help.
Juliatom543
Posted: Thursday, February 28, 2019 12:05:26 AM
Rank: Newbie
Groups: Member

Joined: 2/28/2019
Posts: 1
Thanks for the help @eo_support


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.