Welcome Guest Search | Active Topics | Sign In | Register

auto fill for website Options
Arda Akdogan
Posted: Tuesday, July 25, 2023 7:07:47 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2023
Posts: 5
hello, there is a user name and password on the page I opened via eo.webview, I want them to be filled in automatically and logged in. The site I logged in does not belong to me, how can I do this?

i am using c#
eo_support
Posted: Tuesday, July 25, 2023 10:44:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

You would just load the page into the WebView, then use WebView.EvalScript to fill in the user name and password textbox and submit the login form. Basically, you need to do the same thing the end user is doing through JavaScript.

Please keep in mind that this is not always possible. It is very common that a web page would use a CAPTCHA to detect whether it is really a human to log into the page. If that's the case and you try to automate the process using JavaScript, then most likely you will fail the CAPTCHA test. This is the intended result because the very reason the site author place a CAPTCHA on the page is to stop you from automating the page.

Thanks!
Arda Akdogan
Posted: Tuesday, July 25, 2023 11:03:55 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2023
Posts: 5
https://sistem.generali.com.tr/

I want to do with this site

Quote:
webView3.EvalScript("document.getElementById('txtUsername').value='user_name';");


i see this error
EO.WebBrowser.JSInvokeException: 'EvalScript failed because script engine is not ready or is shutdown before the script can finish. Please use EvalScriptAsync instead of EvalScript to execute JavaScript code in this case.'
eo_support
Posted: Tuesday, July 25, 2023 11:14:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

If your application is based on .NET 4.6 and newer, you can try to use EvalScriptAsync instead:

https://www.essentialobjects.com/doc/eo.extensions.webviewextensions.evalscriptasync__1_overload_1.html

You will need to reference EO.Extensions.dll in order to use this method.

Thanks!
Arda Akdogan
Posted: Tuesday, July 25, 2023 5:18:42 PM
Rank: Newbie
Groups: Member

Joined: 7/25/2023
Posts: 5
I did what you said still didn't work
Arda Akdogan
Posted: Tuesday, July 25, 2023 5:56:04 PM
Rank: Newbie
Groups: Member

Joined: 7/25/2023
Posts: 5
i finished it worked now thanks

i have one more question how can i click the button by id
eo_support
Posted: Wednesday, July 26, 2023 10:27:55 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

You can just do something like this:

Code: C#
await webView3.EvalScriptAsync(@"
document.getElementById('txtUsername').value='user_name';
document.getElementById('txtPassword').value='password';
document.getElementById('ext-gen22').click();
");


The third line clicks the button.

Thanks!
Arda Akdogan
Posted: Thursday, July 27, 2023 3:23:26 AM
Rank: Newbie
Groups: Member

Joined: 7/25/2023
Posts: 5
it works thanks :)
eo_support
Posted: Thursday, July 27, 2023 8:39:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Great! Please feel free to let us know if there is anything else.


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.