Jump to content

Webdriver UDF(based On External Exe)


n3wbie
 Share

Recommended Posts

On 9/13/2017 at 9:31 PM, woodv said:
$chrome=Browser_Setings(9515,@ScriptDir & "\chromedriver.exe")
$session=Browser_create_session()
Browser_openurl($session,"https://www.google.com")
$element=Browser_getelement($session,"xpath","//*[@id='hplogo']")
$imgsrc=browser_get_attribute($session,$element,"scr")
MsgBox(0,"",$imgsrc)
Browser_Setings_close($chrome)

getattribute.png

My test code and result

There is no src in source code

there should be src in source code to find it!

try on some website that have src

Untitled.png

Link to comment
Share on other sites

On 9/13/2017 at 9:31 PM, woodv said:
$chrome=Browser_Setings(9515,@ScriptDir & "\chromedriver.exe")
$session=Browser_create_session()
Browser_openurl($session,"https://www.google.com")
$element=Browser_getelement($session,"xpath","//*[@id='hplogo']")
$imgsrc=browser_get_attribute($session,$element,"scr")
MsgBox(0,"",$imgsrc)
Browser_Setings_close($chrome)

getattribute.png

My test code and result

Even There is typos its src and scr

Link to comment
Share on other sites

On 9/13/2017 at 9:50 PM, n3wbie said:

Even There is typos its src and scr

#include <browserudf.au3>
$chrome=Browser_Setings(9515,@ScriptDir & "/dependencies/chromedriver.exe")
$session=Browser_create_session()
Browser_openurl($session,"https://www.tutorialspoint.com/html/html_images.htm")
$element=Browser_getelement($session,"css selector","body > header > div.container > h1 > a > img")
msgbox(0,0,$element)
$imgsrc=browser_get_attribute($session,$element,"src")
MsgBox(0,"",$imgsrc)
Browser_Setings_close($chrome)

This is working example of same

Link to comment
Share on other sites

3 minutes ago, n3wbie said:
#include <browserudf.au3>
$chrome=Browser_Setings(9515,@ScriptDir & "/dependencies/chromedriver.exe")
$session=Browser_create_session()
Browser_openurl($session,"https://www.tutorialspoint.com/html/html_images.htm")
$element=Browser_getelement($session,"css selector","body > header > div.container > h1 > a > img")
msgbox(0,0,$element)
$imgsrc=browser_get_attribute($session,$element,"src")
MsgBox(0,"",$imgsrc)
Browser_Setings_close($chrome)

This is working example of same

Yes I can get it work now. I do really appreciate your help!

Link to comment
Share on other sites

13 hours ago, n3wbie said:

Yes my udf doesnt support src

U can currently do it with only source

 

I have updated this in my to do list

Also there are some script breaking changes in next version of udf so please beware

Can you also implement these features in the next update?

- Close chrome browser

- Clear history & Cookies

- Support iFrame

Link to comment
Share on other sites

15 minutes ago, woodv said:

Can you also implement these features in the next update?

- Close chrome browser

- Clear history & Cookies

- Support iFrame

Cookie is implemented (ADD/Delete/GET)

Close Chrome Browser Is Implemented(Known Issue Currently is its creating Large Pile of temp Data)

Iframe Support would Not Be In Next Update But its already In My to do list(Not sure if it would be done)

UPDATE:

1.You Get To use ur Profile in new update

2.You Get To Use Chrome As Maximised along with chrome specific Options

Edited by n3wbie
Link to comment
Share on other sites

1 hour ago, n3wbie said:

Cookie is implemented (ADD/Delete/GET)

Close Chrome Browser Is Implemented(Known Issue Currently is its creating Large Pile of temp Data)

Iframe Support would Not Be In Next Update But its already In My to do list(Not sure if it would be done)

UPDATE:

1.You Get To use ur Profile in new update

2.You Get To Use Chrome As Maximised along with chrome specific Options

I'm really excited with upcoming release

Link to comment
Share on other sites

1 hour ago, n3wbie said:

Cookie is implemented (ADD/Delete/GET)

Close Chrome Browser Is Implemented(Known Issue Currently is its creating Large Pile of temp Data)

Iframe Support would Not Be In Next Update But its already In My to do list(Not sure if it would be done)

UPDATE:

1.You Get To use ur Profile in new update

2.You Get To Use Chrome As Maximised along with chrome specific Options

Hi Newbie! Can you please release Close Chrome Browser code for me? cuz I kinda need it for my project...

Link to comment
Share on other sites

2 minutes ago, woodv said:

Hi Newbie! Can you please release Close Chrome Browser code for me? cuz I kinda need it for my project...

Sunday I Will Release Code

Currently its tough as Chrome Browser is using kind of json wire protocol

while Mozilla Ff is Using new W3c Complaint Version

Its Kind of tough to support Both At Same Time

Bcoz of this its creating problem for error Reporting and even some methods are valid for both but some are being discontinued on one end while other works fine

 

Need to work

and even if i update beta version it will lead to errors and wont fulfil ur needs 

better wait till sunday.

Some errors i have reported to chrome driver team 

it would help me resolve errors

Link to comment
Share on other sites

1 minute ago, n3wbie said:

Sunday I Will Release Code

Currently its tough as Chrome Browser is using kind of json wire protocol

while Mozilla Ff is Using new W3c Complaint Version

Its Kind of tough to support Both At Same Time

Bcoz of this its creating problem for error Reporting and even some methods are valid for both but some are being discontinued on one end while other works fine

 

Need to work

and even if i update beta version it will lead to errors and wont fulfil ur needs 

better wait till sunday.

Some errors i have reported to chrome driver team 

it would help me resolve errors

Great!!! Thank you.

Link to comment
Share on other sites

1 hour ago, woodv said:

Hi Newbie! Can you please release Close Chrome Browser code for me? cuz I kinda need it for my project...

You can anytime use following code to close chrome

if ProcessExists("Chrome.exe") then processclose("Chrome.exe")

Caution:there may be lot of temp files generating in%temp% folder

You need to Clean them they will be named as scoped_dir*******

Also if you have more than one instance of chrome at any moment then you need to be careful while using above code

 

Link to comment
Share on other sites

2 hours ago, n3wbie said:

You can anytime use following code to close chrome

if ProcessExists("Chrome.exe") then processclose("Chrome.exe")

Caution:there may be lot of temp files generating in%temp% folder

You need to Clean them they will be named as scoped_dir*******

Also if you have more than one instance of chrome at any moment then you need to be careful while using above code

 

Can chromedriver return PID of Chrome cuz like you said if there are more than 1 chrome instance, it may work incorrect. I dont worry to much about temp files cuz ccleaner can do the job.

Link to comment
Share on other sites

29 minutes ago, woodv said:

Can chromedriver return PID of Chrome cuz like you said if there are more than 1 chrome instance, it may work incorrect. I dont worry to much about temp files cuz ccleaner can do the job.

Chrome driver Doesnt Send Data for pid

instead it can directly close session

wait for update !

Link to comment
Share on other sites

14 minutes ago, woodv said:

I see. Will u support chrome tab in next update?

I m afraid 

you wont be seeing it in next update atleast

although i will put it in my to do list for Upcoming updates

Also I Dont Find Any proper documentation for same

Edited by n3wbie
Link to comment
Share on other sites

2 hours ago, n3wbie said:

I m afraid 

you wont be seeing it in next update atleast

although i will put it in my to do list for Upcoming updates

Also I Dont Find Any proper documentation for same

Hi Newbie

I just found out that the function "browser_openurl" terminate app if chrome takes too long to load the webpage. Please take a look below logs:

$_config[$_nbconf][1] = cmcijzc.
$_path = E:\Project\Autoit\P1\~cxedjgo.tmp
$_cmdssl = E:\Project\Autoit\P1\~cxedjgo.tmp\plink.exe -load cmcijzc. 
"E:\Project\Autoit\myLib\BROWSER.au3" (70) : ==> The requested action with this object has failed.:
$oHTTP.Send($postdata)
$oHTTP^ ERROR
DirRemove E:\Project\Autoit\P1\~cxedjgo.tmp
AutoIt3.exe ended.rc:1
AutoIt3Wrapper Finished.
>Exit code: 1    Time: 48.9

Link to comment
Share on other sites

On 9/14/2017 at 8:09 PM, woodv said:

Hi Newbie

I just found out that the function "browser_openurl" terminate app if chrome takes too long to load the webpage. Please take a look below logs:

$_config[$_nbconf][1] = cmcijzc.
$_path = E:\Project\Autoit\P1\~cxedjgo.tmp
$_cmdssl = E:\Project\Autoit\P1\~cxedjgo.tmp\plink.exe -load cmcijzc. 
"E:\Project\Autoit\myLib\BROWSER.au3" (70) : ==> The requested action with this object has failed.:
$oHTTP.Send($postdata)
$oHTTP^ ERROR
DirRemove E:\Project\Autoit\P1\~cxedjgo.tmp
AutoIt3.exe ended.rc:1
AutoIt3Wrapper Finished.
>Exit code: 1    Time: 48.9

Logs Dont provide Enough Data for tracing What went wrong

Also On most or say every Trial there wasnt any issue for chrome not starting

Update Is Delayed As Chrome Driver 2.32 will now be inlined with W3C specs Instead of old obsolete jsonwire protocol

So Will Have To Change things

Function for Closing Chrome session will be provided in between

 

Link to comment
Share on other sites

17 hours ago, n3wbie said:

Logs Dont provide Enough Data for tracing What went wrong

Also On most or say every Trial there wasnt any issue for chrome not starting

Update Is Delayed As Chrome Driver 2.32 will now be inlined with W3C specs Instead of old obsolete jsonwire protocol

So Will Have To Change things

Function for Closing Chrome session will be provided in between

 

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.

Edited by woodv
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...