Jump to content

Chromedriver issues August 2024


Go to solution Solved by Danp2,

Recommended Posts

On 8/23/2024 at 5:13 PM, Danp2 said:

Unsure if this is intended, but as some of you noticed chromedriver now tries to use a random port on opening. You can override that by supplying the desired port number as a parameter --

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

 

Hugh thanks for this, I had to reinstall after an "upgrade" to Windows 11 and I could not work out what was going on

Link to comment
Share on other sites

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I understand the theory behind webdriver/selenium.
However, it has become the bane of my existence.

Many Autoit IE scripts from more than 10 years ago, still work (even on Windows 11).

It would be nice if webdriver would always be backards compatible,
so that existing scripts always continue to work (if they work now).

Then you would only have to update for bugs that apply to your script/ for new features or the conscious desire to update the stack (webdriver and/or UDF).

Since I switched to webdriver/chromedriver, I have had to modify my scripts 3 times (including this port update).

Link to comment
Share on other sites

16 hours ago, mLipok said:

FYI, this port thing fixes what appears to be the same problem in MS Edge browser.   The wd_demo.au3 file in the 1.3.1 zip file will fail with settings:

Browser:MSEdge
Debug:Full
Update:Current
Headless:No
ConsoleOut:ConsoleWrite

Giving error message:
> wd_demo.au3: _WD_CreateSession
! Error = 10 occurred on: Demo

Even though the web driver will start on port 52534 the session doesn't get created, and the edge browser does not open.

Downloading the Pull 519 version of the wd_demo.au3 and running on port 9515 it works fine.   I'd suggest updating the release asap, because my first stop was to update my core files from the latest release, which still didn't work, Then I found this thread..

 

Link to comment
Share on other sites

18 hours ago, Danp2 said:

Also, you will still need to update your own scripts because nothing is being changed in the core files (only the demo script is updated).

I did, and got my users working again. :) Thanks to all who maintain this function set.

Link to comment
Share on other sites

  • 1 month later...

@Danp2 For some reason edge driver on my end still opening on Port 0. If I downgrade the driver version things return to normal. I have used following as advised in this thread to no avail.

 

_WD_Option('Driver', 'msedgedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\msedge.log"')
    RunAs($TargetUsername, $TargetDomain, $TargetPassword, 2, $DriverPath, "", @SW_SHOW)
    _WD_Option('driverdetect', true)

 

Link to comment
Share on other sites

3 hours ago, abs said:
    RunAs($TargetUsername, $TargetDomain, $TargetPassword, 2, $DriverPath, "", @SW_SHOW)

This is the likely source of your issues. If you are going to launch the webdriver like this instead of letting _WD_Startup do it, then you need to adjust the parameter that you are passing to RunAs to include the additional options that are part of DriverParams.

Link to comment
Share on other sites

Thanks @Danp2, It does make sense what you're saying. I looked at the web driver wrappers and realized the same. However, the webdriver session must run under a particular user to allow windows/ kerberos auth to work. Would you be able to suggest on how do I pass the port number 9515 while using RunAs capability ?

 

 

Link to comment
Share on other sites

This is a derivative of what _WD_Startup does --

Local $sParams = '--port=9515 --verbose --log-path="' & @ScriptDir & '\msedge.log"'
    Local $sCommand = StringFormat('"%s" %s ', $DriverPath, $sParams)

    RunAs($TargetUsername, $TargetDomain, $TargetPassword, 2, $sCommand, "", @SW_SHOW)

Untested, but I assume something like this should work ok.

Link to comment
Share on other sites

Thanks for responding @Danp2. If I use the following Stringformat the driver runs on port 0 and the browser never opens. If I use '"%s" %s' then driver doesn't open at all.

Func SetupEdge()
    
    Local $sParams = '--port=9515 --verbose --log-path="' & @ScriptDir & '\msedge.log"'
    Local $sDriver = "D:\EdgeDriver\msedgedriver.exe"
    Local $sCommand = StringFormat("%s", $sDriver, $sParams)
    RunAs($TargetUsername, $TargetDomain, $TargetPassword, 2, $sCommand, "", @SW_SHOW)
    _WD_Option('driverdetect', true)
    
    ; Run the website in application mode
    Local $sURL = "https://" & $TargetAddress
    Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"args": [ "start-maximized" , "--app=' & $sURL & '"], "binary": "' & StringReplace (@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"]}}}}'
    
    $sSession = _WD_CreateSession($sDesiredCapabilities)
    Return $sSession
    
 EndFunc

 

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