Jump to content

WebDriver UDF - Help & Support (IV)


Recommended Posts

3 hours ago, iSan said:

_WD_SetElementValue($sSession, $VAT_Element, "10", $_WD_OPTION_Standard)

You could try putting the following code before the line above --

_WD_ExecuteScript($sSession, "arguments[0].scrollIntoView(false);", '{"' & __WD_JsonElement($VAT_Element) & '"}')
Sleep(500)

This should cause the target element to be scrolled into view.

FWIW, a new function offering similar functionality will likely get added to the UDF in the future.

Link to comment
Share on other sites

@Danp2 I try as you said:

$VAT_Element =_WD_FindElement($sSession, 'xpath', '//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22"]')
Sleep(200)
_WD_ExecuteScript($sSession, "arguments[0].scrollIntoView(false);", '{"' & __WD_JsonElement($VAT_Element) & '"}')
Sleep(500)
_WD_SetElementValue($sSession, $VAT_Element, "10", $_WD_OPTION_Standard)

Here return form Consol:

__WD_Post ==> Invalid argument [5] : HTTP status = 400
_WD_ExecuteScript ==> Invalid argument [5] : Error occurred when trying to ExecuteScript
__WD_Post ==> Element interaction issue [14] : HTTP status = 400
_WD_ElementAction ==> Element interaction issue [14] : Parameters:   Command=value   Option=<masked>
_WD_SetElementValue ==> Element interaction issue [14] : Parameters:    Element=5d7ae9a6-e7ab-42d1-a774-b2a87be95eca    Value=10    Style=0

 

Link to comment
Share on other sites

13 hours ago, Danp2 said:

@iSanThere was an error in that first line. Try this instead --

_WD_ExecuteScript($sSession, "arguments[0].scrollIntoView(false);", __WD_JsonElement($VAT_Element))

 

@Danp2 That's all i need. Problem is solved, you should mark it. Btw i take 4 posts to present a problem 😁

Thank you and @SOLVE-SMART giving me your patient

Link to comment
Share on other sites

  • 2 weeks later...
InetRead('https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-win32.zip', $INET_FORCERELOAD + $INET_IGNORESSL + $INET_BINARYTRANSFER)

on some systems results in:   Error = 32 Extended = 12157

using this 

 

I was able to check that 

Quote

   If BitAND($iInfoLevel, 1) Then $sErrMsg = "ERROR_INTERNET_SECURITY_CHANNEL_ERROR"
   If BitAND($iInfoLevel, 2) Then $sErrDesc = "The application experienced an internal error loading the SSL libraries."

 

also in Google Chrome I see this:
image.png.0015addc8f57da4ecf3ef099ef8fe58b.png


What is going on ?

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

On 2/2/2023 at 3:19 AM, iSan said:

Thank you and @SOLVE-SMART giving me your patient

I try my best to continue to be patient in the future @iSan 😅 .

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Using FireFox I was able to get more info about the site certs.
Then I get 

http://cacerts.digicert.com/DigiCertTLSHybridECCSHA3842020CA1-1.crt

and add them to Windows Certifacte Storage as a trusted certificate .

Then my problem with InetGet was past.

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

It seems that calls to _WD_ElementAction($sSession, $textboxID, 'value', $string) to replace the value of a text input will fail if $string contains any carriage return characters, e.g. @CR, and returns the following errors:

__WD_Post ==> Invalid argument [5] : HTTP status = 400
_WD_ElementAction ==> Invalid argument [5] : Parameters:   Command=value   Option=<masked>

Similarly, _WD_SetElementValue($sSession, $textBoxID, $string) will also fail if the $string contains a carriage return. Does anyone know of a method to get around this limitation?

Link to comment
Share on other sites

2 hours ago, CodeWriter said:

will fail if $string contains any carriage return characters, e.g. @CR, and returns

TIP: Change any new line to \n

:)

 

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:

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

Thanks, @mLipok for the suggestion. Some background: the text box value is being replaced with a generated report that has paragraph breaks within it. The text box doesn't interpret "\n" as a new line but just literally as the string "\n". I tried replacing @CR with Chr(13) and Chr(10) for @CRLF in the call to _WD_ElementAction() and _SetElementValue() but both still have the same error message.

Edited by CodeWriter
Link to comment
Share on other sites

@CodeWriter_WD_SetElementValue support both a simple and advanced mode. Have you tried using the $_WD_OPTION_Advanced option? If that doesn't work, then I would suggest doing the following --

  • Manually enter multiple lines of text in the text box
  • Use the browser's Dev Tools to examine the element to determine how the multiple lines of text are recorded within the element.
Link to comment
Share on other sites

@Danp2The error output for _WD_ElementAction() was listed above. When I try to set the value of a textBox to "foobar" & @CR, by "fail" I mean that _WD_SetElementAction() using $_WD_OPTION_Advaced does not change the value of the textBox and the error generated is

_WD_SetElementValue ==> Invalid argument [5] : Parameters:    Element=9c970d50-d379-49bc-8387-b651e3b43935    Value=foobar     Style=1

 I haven't exhaustively tested which other characters besides @CR and @CRLF that will cause _WD_SetElementValue() and _WD_ElementAction() to fail, but there might be other special characters that won't be accepted.

Link to comment
Share on other sites

@CodeWriterDid you try $WD_OPTION_Advanced in _WD_SetElementValue in conjunction with @mLipok's suggestion of replacing @CR with \n? If that doesn't work, then I again suggest to do the following --

Quote
  • Use the browser's Dev Tools to examine the element to determine how the multiple lines of text are recorded within the element.

 

Link to comment
Share on other sites

@Danp2That combination worked! Thanks, again. I had tried @mLipoksuggestion of "\n" using _WD_ElementAction() but that didn't work. However, it did work with _WD_SetElementAction() using $_WD_OPTION_Advanced. The browser DEV tools didn't really help and only showed the text exactly as I had manually entered it into the text Box.

Edited by CodeWriter
Link to comment
Share on other sites

Hello All,

I can't get the url or handle from the "Active" Tab.

If I open with WebDriver a new session of Firefox, and I manually open a the tab, if I execute :

$Current_Url = _WD_Action($sSession, 'url')

or

$current_tab = _WD_Window($sSession, 'Window')

It's alway the url or handle of the first tab and not the second 'active' tab.

Any idea?

Thanks

Link to comment
Share on other sites

thanks,

 

So we can't know witch "user' tab" is active.
And I test, if I close the one that was originally opened, I'm getting nothing!

Current URL=__WD_Get ==> Invalid session ID [15] : HTTP status = 404

Then can I get all the opened tab url ? because I would like to continue working with similare tab'name if I found one or other (first tab by exemple) if I don't find similare tab.

thanks

Edited by tac7
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...