Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

Question: Is it possible to add something to browser's local storage?

I've recently learned how to add cookie and that was easy, probably adding to local storage is somehow similar?

;cookie add
    $sName = "cookieName"
    $svalue ="cookieValue"
    $sCookie = '{"cookie": {"name":"' & $sName & '","value":"' & $svalue & '"}}'
    $sRes = _WD_Cookies($sSession, 'add', $sCookie)

 

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/13/2022
On 7/4/2022 at 2:09 PM, Danp2 said:

IDK. I would expect the saved value to be updated each time the function is called with a new value.

What about this scenario:

_MAIN()

Func _Main()
    ; presetting
    $_WD_DEBUG = $_WD_DEBUG_None
    
    _1()
    
    ; restore settings ($_WD_DEBUG_None)
    _WD_DebugSwitch()


    ; set new debug level
    $_WD_DEBUG = $_WD_DEBUG_Error
    ; reset switch internall storage to new setting ($_WD_DEBUG_Error)
    _WD_DebugSwitch(Null)
    
EndFunc

Func _1()
    ; first usage - internally store current settings + switch to $_WD_DEBUG_Full
    _WD_DebugSwitch($_WD_DEBUG_Full)
    ; do your stuff
    _2()
    ; do your stuff
EndFunc

Func _2()
    ; switch to $_WD_DEBUG_Error
    _WD_DebugSwitch($_WD_DEBUG_Error)
    ; do your stuff
EndFunc

This example clearly shows that you need to have direct control over when a stored value is changed.

Here is my modified version:

; #FUNCTION# ====================================================================================================================
; Name ..........: _WD_DebugSwitch
; Description ...: Switch to new debug level or switch back to saved debug level
; Syntax ........: _WD_DebugSwitch([$vMode = Default])
; Parameters ....: $vMode               - [optional] Set new $_WD_DEBUG level. When not specified restore saved debug level.
; Return values .: None
; Author ........: mLipok
; Modified ......:
; Remarks .......: Function saves debug level only at first call
; Related .......:
; Link ..........:
; Example .......: _WD_DebugSwitch($_WD_DEBUG_Full)
; ===============================================================================================================================
Func _WD_DebugSwitch($vMode = Default)
    Local Const $sFuncName = "_WD_DebugSwitch"
    Local Static $_WD_DEBUG_Saved = $_WD_DEBUG ; at first run save currently used debug level, and treat them as "DEFAULT USER CHOICE"
    Local $iErr = $_WD_ERROR_Success

    If $vMode = Default Then ; restore saved debug level
        $_WD_DEBUG = $_WD_DEBUG_Saved
    ElseIf $vMode = Null Then ; reset saved debug level
        $_WD_DEBUG_Saved = $_WD_DEBUG
    ElseIf Not IsInt($vMode) Then
        $iErr = $_WD_ERROR_InvalidDataType
    ElseIf $vMode < $_WD_DEBUG_None Or $vMode > $_WD_DEBUG_Full Then
        $iErr = $_WD_ERROR_InvalidValue
    Else ; set new debug level
        $_WD_DEBUG = $vMode
    EndIf
    Return SetError(__WD_Error($sFuncName, $iErr), 0, '')
EndFunc   ;==>_WD_DebugSwitch

It is a combination of two functionalities, the one that I have used so far, and the possibility of changing the saved value (with Null parameter).

 

EDIT:
Moving discussion about _WD_DebugSwitch() to:

https://github.com/Danp2/au3WebDriver/pull/340

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

18 minutes ago, mLipok said:

What about this scenario:

I think this is an overly complex example of poorly written code.😩 IMO, each of your functions that change the logging level should restore it before exiting the function.

27 minutes ago, mLipok said:
; set new debug level
    $_WD_DEBUG = $_WD_DEBUG_Error
    ; reset switch internall storage to new setting ($_WD_DEBUG_Error)
    _WD_DebugSwitch(Null)

 

This implementation doesn't make sense to me. Why are you manually setting the debug level? Isn't that what _WD_DebugSwitch is supposed to handle?

I'm thinking that you need to consider some alternatives --

  • Use of a stack where you can push / pop debug levels
  • Additional parameters to override default functionality (ie: force update saved debug level)
Link to comment
Share on other sites

Hi Dan,

I have problems in understanding _WD_ElementSelectAction. I want to select an option out of a list but all parameters of _WD_ElementSelectAction seem to retrieve information, not to choose one of the options.

How can I do it?
 

 

Link to comment
Share on other sites

i would like to ask some help:

i downloaded the chm file from your github map, to see how its working, but i can see only the keywords on left side, nothing deeper content on right side..

how its possible?

that is the greatest way when you planned to know something new where the first step is an invalid..  now lets learn..

this is why i dont want to let away ie.. a once for all working method instead of these forced bugged ...

Edited by vkrisz81
Link to comment
Share on other sites

17 minutes ago, Danp2 said:

@vkrisz81You need to unblock the CHM file. See here for explanation.

P.S. This is a common problem with CHM files. It's clear that you are frustrated, but please don't "blame the messenger". 😉

of course, i dont blame the creator, i just am angry because i must to start to a new direction and the first step is blocked by this type errors.. this is not against creators or similar, this is against the system.. new new new systems but are not working.. as well

win xp existed.. how many years? was very stable.

win 7 existed how many years? was stable

now win10.. win11.. and bug bug bug :S

and i am forced to follow this because of .. throw it.. thanks i try to fix this

Link to comment
Share on other sites

Hi Dan,

I have problems with the application of _WD_ElementOptionSelect(). Is the following command correct? It's a pulldown menu with different languages to choose from.

$sXPath = "//a[normalize-space()='Sprache']"
$sValue = "German"
_WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, $sXPath & "//option[contains '" & $sValue & "'")

 

Link to comment
Share on other sites

10 minutes ago, HJL said:

& "'")

Issue is here.

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 have automated the login of a website (https://login.tecalliance.net) with autoit/webdriver. However while logging into the website there is an checkbox "Remember me" (in Dutch: Mij onthouden"). Checking this checkbox will make the next logon faster, however what ever I do, I cannot get the checkbox to be "checked".

The line starting at: $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@name='remember']")
The "source" below is only one of the version I tried to check the checkbox, but I have been at this for about 2 days Googling and searching the forum.

Does anyone have a suggestion to get this checkbox checked ?

image.png.90c2e73d893f3b4036530ef73cbb80dc.png

image.png.dad5306ff407f00f226ff258f1374839.png

#include "wd_core.au3"
#include "wd_helper.au3"


$_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error

Local $sDesiredCapabilities, $sSession, $sElement

$lResult = _WD_UpdateDriver('chrome', Default, Default, true )   ;Update Chromedriver
$lErr = @error


SetupChrome()
$ResSU = _WD_Startup()
$ResSUE = @error
If $ResSU=0 then MsgBox (262144,"","Result Startup = " &  $ResSU & "   " & "Error = " & $ResSUE)



$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Window($sSession, 'maximize')
_WD_Navigate($sSession, "https://login.tecalliance.net")
_WD_LoadWait($sSession)

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='cc-btn cc-dismiss']")
$sRes= @error
if $sRes=$_WD_ERROR_Success then
    _WD_ElementAction($sSession, $sElement, 'click')
    _WD_LoadWait($sSession, 1000)
EndIf

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-focus-indicator log-in-button mat-raised-button mat-button-base']")
$sRes= @error
if $sRes=$_WD_ERROR_Success then
    _WD_ElementAction($sSession, $sElement, 'click')
    _WD_LoadWait($sSession, 1000)
EndIf

Sleep (1000)

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//input[@id="idp-discovery-username"]')
$sRes= @error
If $sRes=$_WD_ERROR_Success then
    _WD_ElementAction($sSession, $sElement, 'value', "test@test.com")
    _WD_LoadWait($sSession,500)
EndIf

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@name='remember']")
;MsgBox ($MB_topmost,$sTitle,"$sElement: " & $sElement)
_WD_ElementAction($sSession, $sElement, 'selected')
_WD_LoadWait($sSession,500)


Exit
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='idp-discovery-submit']")
_WD_ElementAction($sSession, $sElement, 'click')
_WD_LoadWait($sSession,1000)


$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='okta-signin-password']")
_WD_ElementAction($sSession, $sElement, 'value', "Password")
_WD_LoadWait($sSession,1000)


$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='okta-signin-submit']")
_WD_ElementAction($sSession, $sElement, 'click')
_WD_LoadWait($sSession,3500)



KillChromeDriver ()             ; Kill Chromedriver

Func KillChromeDriver()             ; Kill Chromedriver.exe
    Local $aProcessList = ProcessList("chromedriver.exe")
    For $i = 1 To $aProcessList[0][0]
        ProcessClose($aProcessList[$i][1])
    Next
EndFunc


Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false,"prefs": {"credentials_enable_service": false}}}}}'
    $chromeloc = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
    If FileExists ("C:\Program Files\Google\Chrome\Application\chrome.exe") Then $chromeloc = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false,"prefs": {"credentials_enable_service": false}, "binary": "' & $chromeloc & '"}}}}'
EndFunc

 

Link to comment
Share on other sites

1 hour ago, Jemboy said:

image.png.dad5306ff407f00f226ff258f1374839.png

This screenshot shows a case when it is checked or not ?
Give us also the other case.

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

you can use:

document.querySelector("label[for='input34']").click()

or:

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "label[for='input34']"
_WD_ElementAction($sSession, $sElement, 'CLICK')

 

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

@Jemboy

  1. Your post has been moved to this thread in the GH&S section (thanks to the @mod that moved it for me). General questions regarding the UDF belong here, not in the thread in the AutoIt Example Scripts section.
     
  2. Your attempt to check the checkbox using _WD_ElementAction / Select command will never work.
     
  3. Try using WD_ElementActionEx / Check command instead.
     
  4. I doubt that you will achieve the goal of a faster login unless you switch to using an existing user profile.
Edited by Danp2
Link to comment
Share on other sites

On 7/24/2022 at 10:02 PM, Danp2 said:

@HJL You need to correct your usage of "contains". See here for the correct format.

Thanks, now I know how to use "contains". Are there other extras features for "contains" like changing uppercase to lowercase? If, where can I find them?

Next problem:  $_WD_LOCATOR_ByPartialLinkText does not work as expected or is there a thought error?

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="onetrust-accept-btn-handler"]')      ; works
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, '#onetrust-accept-btn-handler')          ; works
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByLinkText, 'onetrust-accept-btn-handler')              ; works
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByPartialLinkText, 'onetrust-accept-btn')               ; @error = 8
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByPartialLinkText, 'onetrust')                          ; @error = 8

 

Link to comment
Share on other sites

What kind of replacement I can use for:

_IEAction($oElement, "scrollintoview", 200, 0, False)

?

 

EDIT:
Only with JavaScript ?
https://stackoverflow.com/a/20487332/5314940

?

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

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/29/2022
  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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