Jump to content

WebDriver UDF - Help & Support (IV)


Recommended Posts

@frank10 Your code runs ok for me (both sessions are created without errors). I would suggest changing this line --

global $sChromeH10 = _WD_SetupChrome(false, "", false)

to

global $sChromeH10 = _WD_SetupChrome(false, "", true)

so that a log files gets created. Then review this log to see if it indicates the source of the problem.

Link to comment
Share on other sites

There are a lot of rows... also with sensible data...

Here are the last rows in which there is some errors, but I can't interpret them...

it seems initially there is a sessionID, but then it disconnects:

Quote

[1690644653.169][DEBUG]: DevTools WebSocket Event: Page.frameStoppedLoading (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "frameId": "F46A6CE7CDE5BA3471EF1AA7DD893630"

}

[1690644653.442][DEBUG]: DevTools WebSocket Event: Page.loadEventFired (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "timestamp": 2056.469381

}

[1690644653.442][DEBUG]: DevTools WebSocket Command: Runtime.evaluate (id=20) (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "awaitPromise": false,

   "expression": "document.readyState",

   "returnByValue": true,

   "uniqueContextId": "-6409993933260785947.8988985567059233541"

}

[1690644653.442][DEBUG]: DevTools WebSocket Event: Page.navigatedWithinDocument (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "frameId": "BB60287079ADFB9F03A3AEBA0CF7BA60",

   "url":  [...................removed info...................]

}

[1690644653.443][DEBUG]: DevTools WebSocket Event: Page.frameStoppedLoading (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "frameId": "BB60287079ADFB9F03A3AEBA0CF7BA60"

}

[1690644653.443][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.167",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644653444808e+12,

      "url":  [...................removed info...................]

   }

}

[1690644653.443][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.168",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644653445864e+12,

      "url": "https://improving.duckduckgo.com/t/verticalopenimages?7495712&ct=IT&d=d&kl=it-it&rl=it-it&kp=-1&biaexp=b&dexp2=f&litexp=c&msvrtexp=b&pmexp=c"

   }

}

[1690644653.444][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.169",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644653446614e+12,

      "url": "https://improving.duckduckgo.com/t/iaoq_images?1393355&ss=0&sp=0&im=1&ism=0&px=0&ul=0&ct=IT&d=d&kl=it-it&rl=it-it&kp=-1&biaexp=b&dexp2=f&litexp=c&msvrtexp=b&pmexp=c"

   }

}

[1690644653.444][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.170",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644653447132e+12,

      "url": "https://improving.duckduckgo.com/t/si?7296702&b=chrome&atbi=false&ei=true&i=false&d=d&l=en_AU&p=windows&pre_atb=v388-4&ax=true&ak=false&serp_return=1&pre_va=_&pre_atbva=_&biaexp=b&dexp2=f&litexp=c&..."

   }

}

[1690644653.444][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.171",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.6906446534475142e+12,

      "url": "https://improving.duckduckgo.com/t/productmenuimpression?4438236&biaexp=b&dexp2=f&litexp=c&msvrtexp=b&pmexp=c"

   }

}

[1690644653.445][DEBUG]: DevTools WebSocket Response: Runtime.evaluate (id=20) (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "result": {

      "type": "string",

      "value": "complete"

   }

}

[1690644653.713][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.173",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644653716503e+12,

      "url":  [...................removed info...................]

   }

}

[1690644654.178][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.247",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644654180629e+12,

      "url":  [...................removed info...................]

   }

}

[1690644654.595][DEBUG]: DevTools WebSocket Event: Log.entryAdded (session_id=E57E83EBC9F58B614227983532FD092C) BB60287079ADFB9F03A3AEBA0CF7BA60 {

   "entry": {

      "level": "error",

      "networkRequestId": "14940.317",

      "source": "network",

      "text": "Failed to load resource: net::ERR_BLOCKED_BY_CLIENT",

      "timestamp": 1.690644654597878e+12,

      "url":  [...................removed info...................]

    }

}

[1690644965.853][DEBUG]: DevTools WebSocket Event: Target.detachedFromTarget (session_id=) browser {

   "sessionId": "E57E83EBC9F58B614227983532FD092C",

   "targetId": "BB60287079ADFB9F03A3AEBA0CF7BA60"

}

[1690644966.947][WARNING]: Processing messages while being disconnected

[1690644966.947][WARNING]: Processing messages while being disconnected

[1690644966.947][SEVERE]: Unable to receive message from renderer

[1690644966.951][INFO]: [bfeaffeeff321af3505d3ec66b50c91b] RESPONSE InitSession ERROR disconnected: Unable to receive message from renderer

  (failed to check if window was closed: disconnected: not connected to DevTools)

  (Session info: chrome=115.0.5790.110)

[1690644966.951][DEBUG]: Log type 'driver' lost 3 entries on destruction

[1690644966.951][DEBUG]: Log type 'browser' lost 10 entries on destruction

 

 

Edited by frank10
Link to comment
Share on other sites

Ok, it must be something on certain opened tabs of the previous session, because if I leave only one tab opened on the same profile, now it works!
A bit disappointing anyway, because you can't trust an automated environment this way... to be sure you should always open a blank browser session instead of an old one...

Link to comment
Share on other sites

I have also another problem:

before I loaded a JS script into chrome with this:

$scriptJS = FileRead($latestFile)
$scriptJS = StringReplace($scriptJS,'\', '\\') 
ConsoleWrite( "____myScript___" & @crlf &  $scriptJS & @crlf)
local $jqueryCommand = "jQuery('head').append(`<script id='myScriptJS'>"   &     $scriptJS   & "</script>`)"
_WD_ExecuteScript($sSession, $jqueryCommand )

with this Output:

Quote

var loadedJS = 0

// ---------------------------------------UTILITY SECTIONS---------------------------------

const _delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

function _convertStringUnicode(str, mode= "fromUnicodeToChar"){

    // console.log("convUnicode:", str, mode)

    if (mode == "fromUnicodeToChar") {

        sUni = /\\\\u(\\d*)/g.exec(str)

[...]

 

And it was fine.
EDIT BTW: the two initial ` inside .append are template literals in JS, not normal quotation marks...

But now when I check the script into chrome it is all in one line (so, after the first // it's all commented out) as:

Quote

var loadedJS = 0// ---------------------------------------UTILITY SECTIONS---------------------------------const _delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));function _convertStringUnicode(str, mode= "fromUnicodeToChar"){// console.log("convUnicode:", str, mode)if (mode ==

So, it seems it's deleting all newlines...
Any changes into _WD_ExecuteScript ? EDIT (with chrome115 problems I updated from an older WD version)
Or is it the new chromedriver 114 / chrome115 ?

Edited by frank10
Link to comment
Share on other sites

checking this issue with:

Quote

// ---------------------------------------UTILITY SECTIONS---------------------------------

 

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

15 minutes ago, mLipok said:

checking this issue with:

// ---------------------------------------UTILITY SECTIONS---------------------------------

https://github.com/Danp2/au3WebDriver/issues/487

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

4 hours ago, frank10 said:

But now when I check the script into chrome it is all in one line (so, after the first // it's all commented out) as:

Quote

var loadedJS = 0// ---------------------------------------UTILITY SECTIONS---------------------------------const _delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));function _convertStringUnicode(str, mode= "fromUnicodeToChar"){// console.log("convUnicode:", str, mode)if (mode ==

So

please provide log from:

_WD_DebugSwitch($_WD_DEBUG_Full)
    _WD_ExecuteScript($sSession, $sJavaScript)
    _WD_DebugSwitch()

of course anonymize them if needed.

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

@frank10 please change in your copy of wd_core.au3:

Func __WD_EscapeString($sData, $iOption = 0)
    If BitAND($iOption, $JSON_MLREFORMAT) Then
;~      $sData = StringRegExpReplace($sData, '[\v\t]', '') ; Strip tabs and CR/LFs ; original
        $sData = StringRegExpReplace($sData, '\t', '') ; Strip tabs ; modified

and give it a try.

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

7 minutes ago, mLipok said:

@frank10 please change in your copy of wd_core.au3:

Func __WD_EscapeString($sData, $iOption = 0)
    If BitAND($iOption, $JSON_MLREFORMAT) Then
;~      $sData = StringRegExpReplace($sData, '[\v\t]', '') ; Strip tabs and CR/LFs ; original
        $sData = StringRegExpReplace($sData, '\t', '') ; Strip tabs ; modified

and give it a try.

Yes, now it's working. Thank you.
But you loose the correct indentation on the script loaded in the browser... not a technical problem, but it could be more pleasant to see the code as it was.
Maybe you could add an option to trim the code or leave it as is.

Link to comment
Share on other sites

14 minutes ago, frank10 said:

But you loose the correct indentation on the script loaded in the browser

Do you refer to triming TABs ?
It is required because some Browser/WebDriver for internall JS processing - they don't support tabs in $sJavaScript string.
If you need to pass TAB in JS string you need to use \t

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

8 minutes ago, mLipok said:

Do you refer to triming TABs ?
It is required because some Browser/WebDriver for internall JS processing - they don't support tabs in $sJavaScript string.
If you need to pass TAB in JS string you need to use \t

example:
 

_Example()
Func _Example()
    Local $sJavaScript = _
            "console.log('test\t1');" & @LF & _ ; supported
            "   console.log('test2');" & @LF & _ ; not supported by WebDriver/Browser so leading TAB should be stripped
            ""
    _WD_DebugSwitch($_WD_DEBUG_Full)
    _WD_ExecuteScript($sSession, $sJavaScript)
    _WD_DebugSwitch()
EndFunc   ;==>_Example

 

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

17 hours ago, mLipok said:

example:
 

_Example()
Func _Example()
    Local $sJavaScript = _
            "console.log('test\t1');" & @LF & _ ; supported
            "   console.log('test2');" & @LF & _ ; not supported by WebDriver/Browser so leading TAB should be stripped
            ""
    _WD_DebugSwitch($_WD_DEBUG_Full)
    _WD_ExecuteScript($sSession, $sJavaScript)
    _WD_DebugSwitch()
EndFunc   ;==>_Example

 

I insert tabs (but not hardcoded \t) when I'm coding with Code, then I save the .js file and then I reload in Autoit with

$scriptJS = FileRead($latestFile)

and inject to the browser with WD.

I always did this way and had no problem at all up to now in chrome.

Link to comment
Share on other sites

It's definitely an error removing tabs, because for example I had this:

let allTotImp = 0
let totAdsUS = 0, totRoyUS = 0

And casually there was a tab instead of space in "let totAdsUS", but visually it seemed a normal space...

But it loaded as

lettotAdsUS = 0, totRoyUS = 0

giving error...

Link to comment
Share on other sites

please change in your copy of wd_core.au3:

Func __WD_EscapeString($sData, $iOption = 0)
    If BitAND($iOption, $JSON_MLREFORMAT) Then
;~      $sData = StringRegExpReplace($sData, '[\v\t]', '') ; Strip tabs and CR/LFs ; original
        $sData = StringRegExpReplace($sData, '\t', ' ') ; replace tabs ; modified

and give it a try.

btw.
https://github.com/Danp2/au3WebDriver/issues/487#issuecomment-1657291194

 

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

27 minutes ago, mLipok said:

please change in your copy of wd_core.au3:

Func __WD_EscapeString($sData, $iOption = 0)
    If BitAND($iOption, $JSON_MLREFORMAT) Then
;~      $sData = StringRegExpReplace($sData, '[\v\t]', '') ; Strip tabs and CR/LFs ; original
        $sData = StringRegExpReplace($sData, '\t', ' ') ; replace tabs ; modified

and give it a try.

btw.
https://github.com/Danp2/au3WebDriver/issues/487#issuecomment-1657291194

 

Yes, this way it's working.

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