Jump to content

Recommended Posts

Posted

I've tried searching the forum and I don't see anywhere that this has been mentioned before... is there a method to save a PDF from Chrome? I've navigated to it after logging in, but is is displayed in Chrome's PDF viewer. I'm not sure if there is a way to disable the PDF viewer in the settings because then it would likely download the file.

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Posted (edited)

Well, I'd like to, but it doesn't appear to be in the latest version of WD Core... is it somewhere else? It looks like you say it was added in version 0.2.0.4, but it's not in 0.2.0.5 😐

Edit: It was released in wd_helper in version 0.2.0.4 and removed in 0.2.0.5. Found it on GitHub's history :)

Edit 2: It was just me. I had an old version, sorry!

Edit 3: It seems like there isn't a valid url for me to download. The pdf is fetched using javascript and displays as a url ending in "searchReport.do" When I try to get the XPath to the download button, it's in a Shadow DOM (which I've only just heard of), so I don't think I can click it

Final Edit: It almost works now. I navigate through the website, open the pdf, switch to that tab, and execute javascript to click the download button. It doesn't work when I pass it through the _WD_ExecuteScript function, but it works in the console. When I execute this:

_WD_ExecuteScript($sSession, 'document.getElementById("toolbar").shadowRoot.getElementById("download").click()')

It returns an error like this:

__WD_Post: URL=HTTP://----------:9515/session/5e1c81743640c4e6c64654d2dbad4172/execute/sync; $sData={"script":"document.getElementById(\"toolbar\").shadowRoot.getElementById(\"download\").click()", "args":[[]]}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"javascript error","message":"javascript error: Cannot read property 'shadowRoot' of null\n  (Session info: chrome=77.0.3865.90)" <-- Stacktrace removed -->
__WD_Post ==> Timeout: {"value":{"error":"javascript error","message":"javascript error: Cannot read property 'shadowRoot' of null\n  (Session info: chrome=77.0.3865.90)" <-- Stacktrace removed -->
_WD_ExecuteScript: {"value":{"error":"javascript error","message":"javascript error: Cannot read property 'shadowRoot' of null\n  (Session info: chrome=77.0.3865.90)" <-- Stacktrace removed -->
_WD_ExecuteScript ==> Timeout: HTTP status = 500
Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

  • 3 weeks later...
Posted

Hi ! i want user proxy , i try "--proxy-server=" but not working . Pls help me ! Thank you

Global $sSession, $sDesiredCapabilities
$Toado = 1
$Stt_Process = 1
$Count_Complete = 0
$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[' & """--blink-settings=imagesEnabled=true""," & " ""--disable-notifications""" & "" & "," & '"' & "--window-size=300,300" & '"' & "," & '"' & "--window-position=" & $Toado * 100 & "," & @DesktopHeight - 350 & "" & '"' & ',"user-data-dir=D:\\ProfileRegDaotung\\' & $Stt_Process & '"' & ',"--proxy-server=113.53.83.212:44664"'&'] }}}}'
MsgBox(0,0,$sDesiredCapabilities)
SetupChrome()
Sleep(500)
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
Sleep(1000)
$Nav = _WD_Navigate($sSession, "https://kiemtraip.com/")

 

  • 3 weeks later...
Posted (edited)

Hi !

I wanted to play the demo with Edge

I had to modify a line on this function : 

 

Func SetupEdge()
    ;_WD_Option('Driver', 'MicrosoftWebDriver.exe')  
    _WD_Option('Driver', 'msedgedriver.exe') ; This is the name of the latest version of the webdriver downloadable on the Microsoft link we get on udf description ( https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
    _WD_Option('Port', 17556)
    _WD_Option('DriverParams', '--verbose')

    $sDesiredCapabilities = '{"capabilities":{}}'
EndFunc   ;==>SetupEdge

And I get this Error : 

_WDStartup: OS:    WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.6
_WDStartup: WinHTTP:    1.6.4.1
_WDStartup: Driver:    msedgedriver.exe
_WDStartup: Params:    --verbose
_WDStartup: Port:    17556
__WD_Post: URL=HTTP://127.0.0.1:17556/session; $sData={"capabilities":{}}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

Anybody can tell me what can I do ?

Great Thanks for your Help :)

 

Edited by danylarson
Posted (edited)

@Danp2


I downloaded the latest version from github and replaced my files

The result still the same


_WDStartup: OS:    WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.6
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    msedgedriver.exe
_WDStartup: Params:    --verbose
_WDStartup: Port:    17556
__WD_Post: URL=HTTP://127.0.0.1:17556/session; $sData={"capabilities":{}}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

Thanks for your fast reply 
Can you test it and  tell me if it works for you using the "msedgedriver.exe'" ?
 

Edited by danylarson
Posted (edited)

@Danp2

I changed the port number

Func SetupEdge()
    ;_WD_Option('Driver', 'MicrosoftWebDriver.exe')
    ;_WD_Option('Port', 17556)

    _WD_Option('Driver', 'msedgedriver.exe')
    _WD_Option('Port', 9515)

    _WD_Option('DriverParams', '--verbose')
    $sDesiredCapabilities = '{"capabilities":{}}'
EndFunc   ;==>SetupEdge

 

now it returns :

DStartup: OS:    WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.6
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    msedgedriver.exe
_WDStartup: Params:    --verbose
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities":{}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"unknown error: cannot find MSEdge binary","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF7A0B172E2+3633890]\n\tOrdinal0 [0x00007FF7A08CB959+1227097]\n\tOrdinal0 [0x00007FF7A081D523+513315]\n\tOrdinal0 [0x00007FF7A081A82F+501807]\n\tOrdinal0 [0x00007FF7A084E3B7+713655]\n\tOrdinal0 [0x00007FF7A084B82F+702511]\n\tOrdinal0 [0x00007FF7A08261B3+549299]\n\tOrdinal0 [0x00007FF7A0826F7E+552830]\n\tOrdinal0 [0x00007FF7A0A4A1F5+2793973]\n\tGetHandleVerifier [0x00007FF7A0BE4CAC+697756]\n\tGetHandleVerifier [0x00007FF7A0BE4A20+697104]\n\tGetHandleVerifier [0x00007FF7A0BF9A91+783233]\n\tGetHandleVerifier [0x00007FF7A0BE5804+700660]\n\tOrdinal0 [0x00007FF7A0A3E2FD+2745085]\n\tOrdinal0 [0x00007FF7A0A4C51C+2802972]\n\tOrdinal0 [0x00007FF7A0A6A72D+2926381]\n\tBaseThreadInitThunk [0x00007FFAADFD7BD4+20]\n\tRtlUserThreadStart [0x00007FFAAE20CED1+33]\n"}}
__WD_Post ==> Timeout: {"value":{"error":"unknown error","message":"unknown error: cannot find MSEdge binary","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF7A0B172E2+3633890]\n\tOrdinal0 [0x00007FF7A08CB959+1227097]\n\tOrdinal0 [0x00007FF7A081D523+513315]\n\tOrdinal0 [0x00007FF7A081A82F+501807]\n\tOrdinal0 [0x00007FF7A084E3B7+713655]\n\tOrdinal0 [0x00007FF7A084B82F+702511]\n\tOrdinal0 [0x00007FF7A08261B3+549299]\n\tOrdinal0 [0x00007FF7A0826F7E+552830]\n\tOrdinal0 [0x00007FF7A0A4A1F5+2793973]\n\tGetHandleVerifier [0x00007FF7A0BE4CAC+697756]\n\tGetHandleVerifier [0x00007FF7A0BE4A20+697104]\n\tGetHandleVerifier [0x00007FF7A0BF9A91+783233]\n\tGetHandleVerifier [0x00007FF7A0BE5804+700660]\n\tOrdinal0 [0x00007FF7A0A3E2FD+2745085]\n\tOrdinal0 [0x00007FF7A0A4C51C+2802972]\n\tOrdinal0 [0x00007FF7A0A6A72D+2926381]\n\tBaseThreadInitThunk [0x00007FFAADFD7BD4+20]\n\tRtlUserThreadStart [0x00007FFAAE20CED1+33]\n"}}
_WD_CreateSession: {"value":{"error":"unknown error","message":"unknown error: cannot find MSEdge binary","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF7A0B172E2+3633890]\n\tOrdinal0 [0x00007FF7A08CB959+1227097]\n\tOrdinal0 [0x00007FF7A081D523+513315]\n\tOrdinal0 [0x00007FF7A081A82F+501807]\n\tOrdinal0 [0x00007FF7A084E3B7+713655]\n\tOrdinal0 [0x00007FF7A084B82F+702511]\n\tOrdinal0 [0x00007FF7A08261B3+549299]\n\tOrdinal0 [0x00007FF7A0826F7E+552830]\n\tOrdinal0 [0x00007FF7A0A4A1F5+2793973]\n\tGetHandleVerifier [0x00007FF7A0BE4CAC+697756]\n\tGetHandleVerifier [0x00007FF7A0BE4A20+697104]\n\tGetHandleVerifier [0x00007FF7A0BF9A91+783233]\n\tGetHandleVerifier [0x00007FF7A0BE5804+700660]\n\tOrdinal0 [0x00007FF7A0A3E2FD+2745085]\n\tOrdinal0 [0x00007FF7A0A4C51C+2802972]\n\tOrdinal0 [0x00007FF7A0A6A72D+2926381]\n\tBaseThreadInitThunk [0x00007FFAADFD7BD4+20]\n\tRtlUserThreadStart [0x00007FFAAE20CED1+33]\n"}}
_WD_CreateSession ==> Webdriver Exception: HTTP status = 500
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/
__WD_Delete: StatusCode=200; ResponseText={"value":null}

The file is at the same level of the demo file

Perhaps I used the wrong file can you give me the link who lead to the right file  if this is the case?


Thanks for your help 


 

Edited by danylarson
Posted
1 hour ago, danylarson said:

"unknown error: cannot find MSEdge binary"

This is telling you that it can't find the executable to launch MSEdge. I actually ran into this same issue yesterday, and it was a bear to figure out the solution. Here's what worked for me --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace (@UserProfileDir, "\", "/") & '/AppData/Local/Microsoft/Edge SxS/Application/msedge.exe"}}}}'

Adjust the location as needed. Your other option is to add the directory containing MSEdge to the Path environmental variable.

Posted


 

@Danp2

Thanks for your Answer

 

_WDStartup: OS:    WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.6
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    msedgedriver.exe
_WDStartup: Params:    --verbose
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "C:/Users/DanyLarson/AppData/Local/Microsoft/Edge SxS/Application/msedge.exe"}}}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"unknown error: no msedge binary at C:/Users/Daniel/AppData/Local/Microsoft/Edge

When I m  looking for the file "msedge.exe"  i don t find it on my drive  and I stated that i don t have this folder on my pc 

/AppData/Local/Microsoft/Edge SxS

Should I need to install something else ?

Great thanks !

Posted

Dear dan . 
I want to click 2 select . But 2 select have same everything (id,class,name,.v.v) 

//input[@name='timezone_id']

how can i select the button select second ? 
Thanks dan !

xxxxxxxxxxx

Posted

How to select a value from a dropdown ist described in my example script here.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

@Danp2

I think I have the latest version of edge

On parameters  i can see  : Microsoft Edge 44.18362.449.0 (Microsoft EdgeHTML 18.18363)

Could you post me the correct instruction if i my version is not corresponding to the code I used ?

Thanks !

Posted (edited)

@Danp2
 

I Installed the latest version of edge

 
Here is my code : 

 

_WD_Option('Driver', 'msedgedriver.exe')
_WD_Option('Port', 9515)

_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\edge.log"')

; I had to change the path  : 

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"}}}}'


Now it returns me invalid argument:


_WDStartup: OS:    WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.6
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver:    msedgedriver.exe
_WDStartup: Params:    --log-path="C:\Users\Danylarson\Desktop\WebDriver Last Version\edge.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"}}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF6B50A8CF2+3640562]\n\tOrdinal0 [0x00007FF6B4FC0589+2688393]\n\tOrdinal0 [0x00007FF6B4E5CC41+1231937]\n\tOrdinal0 [0x00007FF6B4DDA58B+697739]\n\tOrdinal0 [0x00007FF6B4D9CC19+445465]\n\tOrdinal0 [0x00007FF6B4FDD8E5+2808037]\n\tGetHandleVerifier [0x00007FF6B51F2D9C+1209932]\n\tGetHandleVerifier [0x00007FF6B51F2B10+1209280]\n\tGetHandleVerifier [0x00007FF6B5207AD1+1295233]\n\tGetHandleVerifier [0x00007FF6B51F38E4+1212820]\n\tOrdinal0 [0x00007FF6B4FD1648+2758216]\n\tOrdinal0 [0x00007FF6B4D9BC5D+441437]\n\tGetHandleVerifier [0x00007FF6B53AB2A8+3013464]\n\tBaseThreadInitThunk [0x00007FFA83267BD4+20]\n\tRtlUserThreadStart [0x00007FFA84C4CED1+33]\n"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF6B50A8CF2+3640562]\n\tOrdinal0 [0x00007FF6B4FC0589+2688393]\n\tOrdinal0 [0x00007FF6B4E5CC41+1231937]\n\tOrdinal0 [0x00007FF6B4DDA58B+697739]\n\tOrdinal0 [0x00007FF6B4D9CC19+445465]\n\tOrdinal0 [0x00007FF6B4FDD8E5+2808037]\n\tGetHandleVerifier [0x00007FF6B51F2D9C+1209932]\n\tGetHandleVerifier [0x00007FF6B51F2B10+1209280]\n\tGetHandleVerifier [0x00007FF6B5207AD1+1295233]\n\tGetHandleVerifier [0x00007FF6B51F38E4+1212820]\n\tOrdinal0 [0x00007FF6B4FD1648+2758216]\n\tOrdinal0 [0x00007FF6B4D9BC5D+441437]\n\tGetHandleVerifier [0x00007FF6B53AB2A8+3013464]\n\tBaseThreadInitThunk [0x00007FFA83267BD4+20]\n\tRtlUserThreadStart [0x00007FFA84C4CED1+33]\n"}}
_WD_CreateSession ==> Webdriver Exception: invalid argument: missing command parameters
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/
__WD_Delete: StatusCode=200; ResponseText={"value":null}


What Can I try ?

Great Thanks for your help and your patience 

 

Edited by danylarson

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
×
×
  • Create New...