Jump to content

Recommended Posts

  • 2 weeks later...
Posted

FYI.  It appears that the Microsoft Edge WebDriver (msedgedriver.exe) no longer sets a default port of 9515 when it is run and instead assigns one randomly.  This is the one for Edge version 128.0.2739.79.  Anyway, this means that the wonderful wd_demo.au3 doesn't work for Microsoft Edge at the moment unless you edit line 1255 of wd_demo.au3 and change it to:

_WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\msedge.log"')

This will then cause msedgedriver.exe to use port 9515 which is what wd_demo.au3 is expecting.

I don't know if this change is something will persist in future releases but this change should continue to work regardless.  This had me stumped for a while so I hope it saves someone else some time.

Posted (edited)

Did you check recently merged pull requests ?

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Hi @Danp2, hi @mLipok 👋 ,

by the recently several questions regarding the "port-behavior-change" / "port-topic", we see the people leaning for the new release (v1.4.0 (I guess)).
When do you plan to publish this one? Because I think the users download the latest release instead of using the current "master" branch state.

I am curious about your feedback, thanks 🤝 .

Best regards
Sven

Stay innovative!

  Reveal hidden contents
Posted

this decision is up to you @Danp2 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 9/19/2024 at 11:55 AM, Danp2 said:

I think you wrote this description, and not sure how it slipped through without further discussion. 😏

Expand  

I don't think so 🤔 , maybe @mLipok had questions about the verbiage of URL option. But let's discuss this in the GitHub Issue 🤝 .

  On 9/19/2024 at 11:55 AM, Danp2 said:

Soon I imagine.

Expand  

Wonderful, thanks Dan 👌 .

Best regards
Sven

Stay innovative!

  Reveal hidden contents
Posted (edited)
  On 9/18/2024 at 8:47 PM, chinadoug said:

FYI.  It appears that the Microsoft Edge WebDriver (msedgedriver.exe) no longer sets a default port of 9515 when it is run and instead assigns one randomly.  This is the one for Edge version 128.0.2739.79.  Anyway, this means that the wonderful wd_demo.au3 doesn't work for Microsoft Edge at the moment unless you edit line 1255 of wd_demo.au3 and change it to:

_WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\msedge.log"')

This will then cause msedgedriver.exe to use port 9515 which is what wd_demo.au3 is expecting.

 

Expand  

This doesn't work in my programs: I still get error 10 when using msedgedriver. And the second line "...Port , 9515" I did have before. Isn't that the same as --port=9515?

_WD_Option('Driver', $sWebDriverFileEdge)
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & $sLogsPath & 'edge.log"')

 

Edited by HJL
Posted

But neither wd_demo nor my programm works with it. Where is the error?

Func _SetupEdge()
    Local $sFuncName = "SetupEdge"
    _WD_Option('Driver', $sWebDriverFileEdge)
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & $sLogsPath & 'edge.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"w3c": true,"excludeSwitches": [ "enable-automation"], "args":["user-data-dir=C:\\Menu\\EDGE_WD_Profile"]}}}}'
EndFunc   ;==>SetupEdge

 

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 2024/09/21
Posted

 Latest update just released. See below for change log.

  Quote

## [1.4.0] 2024-09-21

### Changed

- WD_GetTable: Trim whitespace in cell contents
- WD_Window: Add support for Restore option (@Sven-Seyfert)
- _WD_UpdateDriver: Optionally specific target browser version (@mlipok)

### Fixed

- wd_demo: Pass port number in DriverParams
- _WD_JsonActionKey: Don't encode Unicode characters

### Project

- __WD_ErrHnd: Enhance to handle COM errors (@mlipok)

Expand  

 

Posted
Func _SetupEdge()
    Local $sFuncName = "SetupEdge"
    _WD_Option('Driver', $sWebDriverFileEdge)
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & $sLogsPath & 'edge.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"w3c": true,"excludeSwitches": [ "enable-automation"], "args":["user-data-dir=C:\\BlpMenu\\EDGE_WD_Profile"]}}}}'
EndFunc   ;==>SetupEdge

===================================================================================

_WD_Option ==> Success [0] : Parameters:   Option=Driver   Value=i:\blpmenu\webdriver\user\msedgedriver.exe
_WD_Option ==> Success [0] : Parameters:   Option=Port   Value=9515
_WD_Option ==> Success [0] : Parameters:   Option=DriverParams   Value=--log-path="c:\webdriver\msedge.log"
@@ Debug(2111) : 4e3.StartAnmeldung: 2019 Aufruf _WD_Startup
_WD_GetFreePort ==> Success [0 / 9515] : Parameters:   MinPort=9515   MaxPort=Default
_WD_IsLatestRelease ==> Success [0] : True
_WD_Startup: OS:    WIN_10 X64 19045 
_WD_Startup: AutoIt:    3.3.16.1
_WD_Startup: Webdriver UDF: 1.4.0 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.2
_WD_Startup: Driver:    i:\blpmenu\webdriver\user\msedgedriver.exe (32 Bit)
_WD_Startup: Params:    --log-path="c:\webdriver\msedge.log"
_WD_Startup: Port:  9515
_WD_Startup: Command:   "i:\blpmenu\webdriver\user\msedgedriver.exe" --log-path="c:\webdriver\msedge.log" 
_WD_Startup ==> Success [0]
@@ Debug(2113) : 4e4.StartAnmeldung: 2021 nach BLP-WD_Startup und BrowserSetup @error=0
__WD_Post ==> Send / Recv error [6] : HTTP status = 0
_WD_CreateSession ==> Webdriver Exception [10]

===================================================================================

Starting Microsoft Edge WebDriver 129.0.2792.52 (6462e8fc16ec8b62bef06801adff3cbeccd6a7d4) on port 0
To submit feedback, report a bug, or suggest new features, please visit https://github.com/MicrosoftEdge/EdgeWebDriver

Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.

Microsoft Edge WebDriver was started successfully.
msedgedriver was started successfully on port 56004.

Hi Dan, I hope this information helps to see my problem with MsEdge. I define port 9515 and it was startet with port 56004.

Posted (edited)

Hi @HJL 👋 ,https://github.com/Sven-Seyfert/autoit-webdriver-boilerplate?tab=readme-ov-file#configuration

this output line does not include --port=9515, which should be the case.

_WD_Startup: Command:   "i:\blpmenu\webdriver\user\msedgedriver.exe" --log-path="c:\webdriver\msedge.log"
  • Your capabilities string looks good, so follow the suggestion of @Danp2.
  • You could also try to skip the user-data-dir and see if the behavior is still the same.

Still no luck? Please tryout this: https://github.com/Sven-Seyfert/autoit-webdriver-boilerplate

  • clone the repo (or download the latest release)
  • read the README.md file
  • set msedge (like described here)
  • run it and let us know if it works

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

  Reveal hidden contents
Posted

You are right, the info of the missing --port=9515 helped. I had another Func _SetupMsEdge() that I used and the changes I made in an old Func _SetupEdge(). Thanks a lot for your help.

Posted (edited)

Another question: is it possible to hide the info about automation with a param for chromedriver or msedgedriver setup? It always takes a lot of place in the window.

image.png.a255c58da63944ce49fd0b8699bf0cdc.png

Edited by HJL
Posted

The condition (option) is "--enable-automation" and I believe you already used it before in your capabilities string....
I do it in this way ...

_WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')

... and that's enough.

Anyways, when you struggle with the width and height of the *driver, you can also set the browser mode to maximize or even to fullscreen (which should do a F11).

_WD_Window($sSession, 'maximize')

; or 

_WD_Window($sSession, 'fullscreen')

I hope this will help you 👌 .
In case your native language is german (because of "benzinpreise.de"), you could also see some of my how-to videos here, to get a bit of a crash course for the webdriver.

Best regards
Sven

Stay innovative!

  Reveal hidden contents
  • 2 weeks later...
Posted

Dear Danp2

i was using 

$sCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}'

i changed to:

Func SetupChrome();$bHeadless)
    $bHeadless = True
    _WD_Option('Driver', 'chromedriver.exe')
    Local $iPort = _WD_GetFreePort(5555, 5600)
    
    If @error Then Return SetError(@error, @extended, 0)

    _WD_Option('Port', $iPort)
    _WD_Option('DriverParams', '--port=' & $iPort & ' --verbose --log-path="' & @ScriptDir & '\chrome.log"')
     ;;$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}'

    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'chrome')
    _WD_CapabilitiesAdd('w3c', True)
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')

    If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless')
    _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo
    Local $sCapabilities = _WD_CapabilitiesGet()
    
    Return $sCapabilities
EndFunc   ;==>SetupChrome

  Reveal hidden contents

 

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...