Jump to content

WebDriver UDF (W3C compliant version) - 2024/09/21


Danp2
 Share

Recommended Posts

7 hours ago, davidnina333 said:

How can I open multiple firefox browsers at the same time ? Every firefox is a different profile.

This should be possible, but it's not something I have attempted to do. The basic concept would follow these steps --

  1. Launch multiple Geckodriver instances. Each one needs it's own port number (set with _WD_Option / DriverParams before calling _WD_Startup)
  2. Switch between Geckodriver instances by changing the port number with _WD_Option / Port.
  3. Issue the Webdriver command(s) to communicate with the currently active instance of Geckodriver
  4. Return to Step 2 as needed

Give it a go and let us know the results. :)

Link to comment
Share on other sites

15 hours ago, Danp2 said:

This should be possible, but it's not something I have attempted to do. The basic concept would follow these steps --

  1. Launch multiple Geckodriver instances. Each one needs it's own port number (set with _WD_Option / DriverParams before calling _WD_Startup)
  2. Switch between Geckodriver instances by changing the port number with _WD_Option / Port.
  3. Issue the Webdriver command(s) to communicate with the currently active instance of Geckodriver
  4. Return to Step 2 as needed

Give it a go and let us know the results. :)

Thanks for your help. You're right. It Work inefficient.

How to open multiple geckodriver and each geckodriver a firefox ?

Thanks.

Edited by davidnina333
Link to comment
Share on other sites

43 minutes ago, PaulC said:

Great, very desirable!

 

23 hours ago, Danp2 said:

once developed,  the function(s) can be added to wd_helper. Submissions are welcomed.

@PaulC I think @Danp2 mean that any contribution to this UDF are welcomed. So you should take it in your hands, develop desired function, and share your results to community. Of course you can get help in your work but you must get involved in a development process.

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

4 minutes ago, mLipok said:

you can choose to get involved in a development process.

FTFY. B)

I was looking into this just now. It seems that I hadn't added the screenshot functionality to _WD_ElementAction, so expect that modification to be added ASAP.

Next step would be to decide the correct way to implement the new functionality --

  • One vs multiple functions
  • Supported output types (base64, raw (decoded base64), file, etc)
  • Etc
Link to comment
Share on other sites

12 minutes ago, mLipok said:

 

@PaulC I think @Danp2 mean that any contribution to this UDF are welcomed. So you should take it in your hands, develop desired function, and share your results to community. Of course you can get help in your work but you must get involved in a development process.

Thank your for explaining !

Link to comment
Share on other sites

1 hour ago, Danp2 said:

FTFY. B)

Thanks for lesson.
I must ask my teacher about my wording/vocabulary mistakes here .... in the end I signed up for individual lessons, with a teacher in the "direct english" system.

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

@Danp2 I found another change in the behaviour of chromedriver after the latest update. I have 2 computers: one desktop connected to router by cable, which contains all the webdriver programs in a shared folder, and a notebook connected to the router by wifi. In the past my notebook could run webdriver programs on the desktop. Now the notebook cannot run them. It seems that the notebook cannot create a webdriver session. The debug message says "Only local connections are allowed." When I connect the notebook to the router with hard cable, the programs run OK. Please let me know if there is a solution.

Thanks and regards,

CY Cho

Edited by CYCho
Link to comment
Share on other sites

2 hours ago, CYCho said:

The debug message says "Only local connections are allowed." When I connect the notebook to the router with hard cable, the programs run OK

@CYCho Does this message appear in Scite? FWIW, I see this same message in the Chromedriver console.

This sounds more like a network configuration issue than a problem with the CD. I assume you are using v2.45 of CD. You could test this scenario with that version and v2.44 to see if one works and the other doesn't.

Link to comment
Share on other sites

@Danp2 I tested this in both CD 2.44 and 2.45. The CD console says:

Starting ChromeDriver 2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387) on port 9515
Only local connections are allowed.

The SciTE console shows:
>"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "\\Ultra-PC\d\Chrome\Chrome-Logon.au3" /UserParams    
+>05:00:33 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000412  OS:WIN_10/  CPU:X64 OS:X86  Environment(Language:0412)  CodePage:949  utf8.auto.check:4
+>         SciTEDir => C:\Program Files\AutoIt3\SciTE   UserDir => C:\Users\CYCho\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\CYCho\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.3)  from:C:\Program Files\AutoIt3  input:\\Ultra-PC\d\Chrome\Chrome-Logon.au3
+>05:00:34 AU3Check ended.rc:0
>Running:(3.3.14.3):C:\Program Files\AutoIt3\autoit3.exe "\\Ultra-PC\d\Chrome\Chrome-Logon.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
_WDStartup: OS:    WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt:    3.3.14.3
_WDStartup: WD.au3:    0.1.0.16
_WDStartup: Driver:    webdriver\chromedriver.exe
_WDStartup: Params:    --log-path=\\Ultra-PC\d\Chrome\chrome.log
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", "goog:chromeOptions": {"w3c": true, "args": ["start-maximized", "disable-infobars"] }}}}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
 

Link to comment
Share on other sites

35 minutes ago, CYCho said:

Starting ChromeDriver 2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387) on port 9515
Only local connections are allowed.

This is normal behavior

37 minutes ago, CYCho said:

__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

Have you tried looking in the chrome.log file for additional details?

Link to comment
Share on other sites

@CYCho My guess is that it's due to some kind of rights issue. Unfortunately, I don't know how to be of further assistance. Suggest that you troubleshoot on your end to try to identify the cause --

  • Does it work if you run everything local on the laptop?
  • Where is the Chrome application installed?
  • Are you able to run the routines in wd_demo.au3?
  • Etc
Link to comment
Share on other sites

@Danp2 The chromedriver.exe are installed in both computers, but au3 files are only in the shared folder of desktop. The notebook runs all local au3 files OK. It even runs all au3 files in the desktop if it is connected to router by cable. The problem happens when the notebook is on wifi, even though it still has access to the files in the desktop.

Link to comment
Share on other sites

I changed my codes so that local chromedriver.exe is used when the notebook creates a webdriver session and the problem was solved. Still unresolved is why the notebook can run a program in the desktop when connected by cable and cannot run the same program when connected by wifi in the same local network.

Thank you for your hint.

Edited by CYCho
Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 2024/09/21
  • Melba23 pinned this topic

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