Jump to content

Webdriver UDF(based On External Exe)


n3wbie
 Share

Recommended Posts

1 hour ago, woodv said:

This is your udf log.

{"sessionId":"1f95e9722f3d6a8eac6cf7ee36a6a8d1","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a)","userDataDir":"C:\\Users\\20gg\\AppData\\Local\\Temp\\scoped_dir12696_26390"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"60.0.3112.113","webStorageEnabled":true}}

 

Here 's autoit log:

"E:\Project\Autoit\myLib\Browserudf.au3" (70) : ==> The requested action with this object has failed.:
$oHTTP.Send($postdata)
$oHTTP^ ERROR
DirRemove E:\Project\Autoit\APPLEID_V2\~lgfdvag.tmp
-> AutoIt3.exe ended.rc:1
+> AutoIt3Wrapper Finished.
>Exit code: 1    Time: 50.58

 

This only happens when network is slow and chrome takes too much time to load webpage.

Would Add Flag In Next Version To Increase Timeouts of Autoit script

Another Option For U Would be Using Com Error Handlers as work Around

Link to comment
Share on other sites

  • 2 weeks later...
On 10/1/2017 at 0:07 AM, woodv said:

HI, do you have plan for next release?

I Wrote Udf based On old Jsonwire Protocol and now its totally changed

So it would take some time

Over and Above m busy with some other stuffs

Edited by n3wbie
Link to comment
Share on other sites

  • 3 months later...

@n3wbi3 Have you made any further progress on this? FWIW, I have been working on a similar UDF. I am primarily working with FF. In limited testing with Chrome, I've noticed that the JSON being returned by these drivers is substantially different. For example --

FF Version

{"value": {"sessionId":"9f5ee207-b7f3-4288-b643-1e9afcd9cbb8","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"54.0.1","moz:accessibilityChecks":false,"moz:processID":6504,"moz:profile":"C:\\Users\\Dan\\AppData\\Local\\Temp\\rust_mozprofile.LVcWTJkn0esD","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"10.0","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}

Chrome Version

{"sessionId":"ef3cb4ae820ea871a274f2088db94993","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1)","userDataDir":"C:\\Users\\Dan\\AppData\\Local\\Temp\\scoped_dir1584_22850"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"63.0.3239.132","webStorageEnabled":true}}

My goal would be able to handle both of these with a single set of code. I'm currently using the JSON UDF from Ward.

Anyone have any ideas or suggestions?

Dan

Link to comment
Share on other sites

1 hour ago, Danp2 said:

@n3wbi3 Have you made any further progress on this? FWIW, I have been working on a similar UDF. I am primarily working with FF. In limited testing with Chrome, I've noticed that the JSON being returned by these drivers is substantially different. For example --

FF Version

{"value": {"sessionId":"9f5ee207-b7f3-4288-b643-1e9afcd9cbb8","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"54.0.1","moz:accessibilityChecks":false,"moz:processID":6504,"moz:profile":"C:\\Users\\Dan\\AppData\\Local\\Temp\\rust_mozprofile.LVcWTJkn0esD","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"10.0","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}

Chrome Version

{"sessionId":"ef3cb4ae820ea871a274f2088db94993","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1)","userDataDir":"C:\\Users\\Dan\\AppData\\Local\\Temp\\scoped_dir1584_22850"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"63.0.3239.132","webStorageEnabled":true}}

My goal would be able to handle both of these with a single set of code. I'm currently using the JSON UDF from Ward.

Anyone have any ideas or suggestions?

Dan

Yes dan it is

Due to same reason i discontinued or can say messed up whole idea of udf

 

Yes m also using wards json udf

Actually problem lies with chrome ...

Firefox is proper...

So i recommend you to change start chrome with w3c complaint spec payload and it returns output in form which would be similar to other browsers...

I had raised this issue to developer to which chromedriver is now w3c spec complaint now.most probably after version 2.34 if m not wrong

Also if u are trying to make udf you may take up this project from here itself

Edited by n3wbie
Link to comment
Share on other sites

6 minutes ago, Danp2 said:

I'm using the latest version of chromedriver AFAICS. Can you share the details on starting chrome in w3c mode?

Ya sure ...give me some time...

I will share soon... 

Starting payload at session start has w3c in chromedriver capabilaities dictionary... I will share you exact payload or exact word in some time...

I need to find my old backups...

If i dont find them i will figure out and surely send

Link to comment
Share on other sites

5 hours ago, Danp2 said:

I'm using the latest version of chromedriver AFAICS. Can you share the details on starting chrome in w3c mode?

I found an example of using ChromeOptions, and I'll play with that when I get some time.

Thanks!

 

5 hours ago, n3wbie said:

Ya sure ...give me some time...

I will share soon... 

Starting payload at session start has w3c in chromedriver capabilaities dictionary... I will share you exact payload or exact word in some time...

I need to find my old backups...

If i dont find them i will figure out and surely send

 

 

Here U need to pass 'w3c' flag inside goog:chromeOptions

May be in my above udf you may not understand where to add it 

but if u r making it with json ward udf

ur output shud atleast contain similar thing in it

{"capabilities": 
   {"alwaysMatch": 
     {"chromeOptions": 
       {"w3c": true } 
     } 
   } 
}

Hope this helps

Link to comment
Share on other sites

7 hours ago, Danp2 said:

@n3wbi3 Have you made any further progress on this? FWIW, I have been working on a similar UDF. I am primarily working with FF. In limited testing with Chrome, I've noticed that the JSON being returned by these drivers is substantially different. For example --

FF Version

{"value": {"sessionId":"9f5ee207-b7f3-4288-b643-1e9afcd9cbb8","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"54.0.1","moz:accessibilityChecks":false,"moz:processID":6504,"moz:profile":"C:\\Users\\Dan\\AppData\\Local\\Temp\\rust_mozprofile.LVcWTJkn0esD","pageLoadStrategy":"normal","platformName":"windows_nt","platformVersion":"10.0","rotatable":false,"specificationLevel":0,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000}}}}

Chrome Version

{"sessionId":"ef3cb4ae820ea871a274f2088db94993","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1)","userDataDir":"C:\\Users\\Dan\\AppData\\Local\\Temp\\scoped_dir1584_22850"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"63.0.3239.132","webStorageEnabled":true}}

My goal would be able to handle both of these with a single set of code. I'm currently using the JSON UDF from Ward.

Anyone have any ideas or suggestions?

Dan

Update to above post

FF driver ie. Gecko Driver uses latest W3c Specifications as default

Whereas Chrome Driver uses Obsolute JSONwire Protocol 

The Major reason For Change in  things

Thats why my udf had an if condition

But it was too difficult to keep up the same in all Functions

So It became too messy and i had to leave UDF in same state

But now after reporting issue to chrome driver developers they have came up with flag for W3c complaint 

which i mentioned above

i havnt tested it yet but yes i have atleast gone through documentations of above

if you are interested We may together join in and make a new udf of webdrivers for benefit of people at large!

Direct msg me on forum if interested

Link to comment
Share on other sites

I can now set the element values in Chrome. Issue was due to missing "value" parameter, which FireFox doesn't require.

Now I'm seeing an issue with retrieving element values. The spec shows that we should do this --

GET /session/{session id}/element/{element id}/text

However, this always returns an empty value ({"value":""}) for both FF and Chrome. If I change the request to this --

GET /session/{session id}/element/{element id}/value

then the desired value is returned.

Thoughts?

Link to comment
Share on other sites

28 minutes ago, Danp2 said:

I can now set the element values in Chrome. Issue was due to missing "value" parameter, which FireFox doesn't require.

Now I'm seeing an issue with retrieving element values. The spec shows that we should do this --

GET /session/{session id}/element/{element id}/text

However, this always returns an empty value ({"value":""}) for both FF and Chrome. If I change the request to this --

GET /session/{session id}/element/{element id}/value

then the desired value is returned.

Thoughts?

At the moment when i wrote udf i didnt had knowledge of new protocol and i did it with trials and errors so my version is more or less olderversion

 

Which i was trying to make it inline with all browser drivers 

 

But i failed and left it undone...

So u maybhave different endpoints also payloads may change and also methods may change... 

If u r keen to make a new udf and test i would love to write it from scratch again...

Link to comment
Share on other sites

1 minute ago, Danp2 said:

@n3wbie That essentially what I'm in the process of doing now. Once I get it mostly "feature complete", I will start a new thread and post it here. Will also likely put it up on Github for future enhancements / maintenance.

Cool enough...browser related specs are available at respective site itself u may have a look into that also i suggest that are way too helpful for debuging

Edited by n3wbie
Link to comment
Share on other sites

11 hours ago, Danp2 said:

You mean this? If so, that's what I'm already using as a reference.

Any input is appreciated. ;-)

Things u showed are webdriver specs

https://sites.google.com/a/chromium.org/chromedriver/capabilities M Talking Abt Capabuilities

This is for particular fire fox

https://github.com/mozilla/geckodriver#mozfirefoxoptions

11 hours ago, Danp2 said:

You can see all of the Chromedriver command mappings here. It appears that they have two different functions for retrieving the element text and value. However, I can't find this distinction in the WD W3C specs.

This is because of 2 different version

Earlier version had different specs for text and value

Value was particularly used to directly input

For example if i say if ur page had some javascript validation of field like if u type in that field then only some other things happen

so value command wont work there 

you ll need to use text command and use send keys sometime

although now i dont see both different

and kind of text was to retrieve and value was to set value

Not sure enough will Update you on this soon

May Be m wrong in interpretating above .But this is my belief

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...