Jump to content

WebDriver UDF - Help & Support


Recommended Posts

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is the "General Help and Support" thread for the WebDriver UDF. The UDF itself can be downloaded here. So if you have any questions, suggestions or errors please post here.

use the _WD_ElementAction function like this: $sValue = _WD_ElementAction($sSession, $sElement, 'attribute', 'src') p.s. ... and remove @src from the xPath: "//img[@alt='NiceGirl']"

Time ago I wrote a function to extract data from  the source HTML code of tables. https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ Seems that that fun

Posted Images

@damp

I solve my problem making delay  like following and after iall is working 

$sbutton= _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath,"//button[@id='action.save' and @name='action'  and @class='btn btn-md btn-primary col-md-3 pull-right']")
Local $test92 = _WD_ElementAction($sSession, $sbutton, 'click')
sleep(1000)

Thanks 
 

Link to post
Share on other sites
#include <Array.au3>
#include 'wd_helper.au3'

$_WD_DEBUG = False
Global $sDesiredCapabilities
Global $sSession

_SetupIE()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

_Example()

Func _Example()
    _WD_Navigate($sSession, "https://docs.microsoft.com/en-us/windows/win32/controls/window-controls")

     $aTables = _WD_FindElement($sSession,"tag name", "table", '', True)
     if @error=0 then
        _ArrayDisplay($aTables)
     Else
        ConsoleWrite("@error=" & @error & @CRLF)
    EndIf
EndFunc

Func _SetupIE()
    _WD_Option('Driver', 'IEDriverServer.exe')
    _WD_Option('Port', 5555)
    _WD_Option('DriverParams', '--log-file=' & @ScriptDir & '\IE.log')
    $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc   ;==>_SetupIE

An error occurred after running the above code, as follows:

_WDStartup: OS    : WIN_7 WIN32_NT 7601 Service Pack 1
_WDStartup: AutoIt: 3.3.14.2
_WDStartup: WD.au3: 0.1.0.19
_WDStartup: Driver: IEDriverServer.exe
_WDStartup: Params: --log-file=I:\IE.log
_WDStartup: Port  : 5555

__WD_Post: URL=HTTP://127.0.0.1:5555/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}

__WD_Post: StatusCode=200; ResponseText={
    "value" : 
    {
        "capabilities" : 
        {
            "acceptInsecureCerts" : false,
            "browserName" : "internet explorer",
            "browserVersion" : "11",
            "pageLoadStrategy" : "normal",
            "platformName" : "windows",
            "proxy" : {},
            "se:ieOptions" : 
            {
                "browserAttachTimeout" : 0,
                "elementScrollBehavior" : 0,
                "enablePersistentHover" : true,
                "ie.browserCommandŤ°Ć.witches" : "",
                "ie.ensureCleanSession" : false,
                "ie.fileUploadDialogTimeout" : 3000,
                "ie.forceCreateProcessApi" : false,
                "ignoreProtectedModeSettings" : false,
                "ignoreZoomSetting" : false,
                "initialBrowserUrl" : "http://localhost:5555/",
                "nativeEvents" : true,
                "requireWindowFocus" : false
            },
            "setWindowRect" : true,
            "timeouts" : 
            {
                "implicit" : 0,
                "pageLoad" : 300000,
                "script" : 30000
            },
            "unhandledPromptBehavior" : "dismiss"
        },
        "sessionId" : "b8a652a9-be13-4ec2-8fa9-24a36795371a"
    }
}

_WD_CreateSession: {
    "value" : 
    {
        "capabilities" : 
        {
            "acceptInsecureCerts" : false,
            "browserName" : "internet explorer",
            "browserVersion" : "11",
            "pageLoadStrategy" : "normal",
            "platformName" : "windows",
            "proxy" : {},
            "se:ieOptions" : 
            {
                "browserAttachTimeout" : 0,
                "elementScrollBehavior" : 0,
                "enablePersistentHover" : true,
                "ie.browserCommandŤ°Ć.witches" : "",
                "ie.ensureCleanSession" : false,
                "ie.fileUploadDialogTimeout" : 3000,
                "ie.forceCreateProcessApi" : false,
                "ignoreProtectedModeSettings" : false,
                "ignoreZoomSetting" : false,
                "initialBrowserUrl" : "http://localhost:5555/",
                "nativeEvents" : true,
                "requireWindowFocus" : false
            },
            "setWindowRect" : true,
            "timeouts" : 
            {
                "implicit" : 0,
                "pageLoad" : 300000,
                "script" : 30000
            },
            "unhandledPromptBehavior" : "dismiss"
        },
        "sessionId" : "b8a652a9-be13-4ec2-8fa9-24a36795371a"
    }
}

__WD_Post: URL=HTTP://127.0.0.1:5555/session/b8a652a9-be13-4ec2-8fa9-24a36795371a/url; $sData={"url":"https://docs.microsoft.com/en-us/windows/win32/controls/window-controls"}

__WD_Post: StatusCode=200; ResponseText={
    "value" : null
}

_WD_Navigate: {
    "value" : null
}

__WD_Post: URL=HTTP://127.0.0.1:5555/session/b8a652a9-be13-4ec2-8fa9-24a36795371a/elements; $sData={"using":"tag name","value":"table"}

__WD_Post: StatusCode=404; ResponseText={
    "value" : 
    {
        "data" : null,
        "error" : "no such window",
        "message" : "Currently focused window has been closed.",
        "stacktrace" : ""
    }
}

[_WD_FindElement: {
    "value" : 
    {
        "data" : null,
        "error" : "no such window",
        "message" : "Currently focused window has been closed.",
        "stacktrace" : ""
    }
}]

@error=9

why?

thanks in advanceÔľĀ

Link to post
Share on other sites

Dear @Danp2
I am new and I look forward to your support in this regard:
I saw the example in the demo file and it seems that it only has an example of WD_Action with mouse:
$sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"'
$sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}'
I want to send the {pagedown} key in WD, what should I do?
Thank you!

Edited by nguyenthaiytcc
Link to post
Share on other sites

How can i change the select option with the following sentence 

<div role="combobox" class="v-filterselect v-widget v-has-width" style="width: 20em;">

<input type="text" class="v-filterselect-input" autocomplete="nope" id="gwt-uid-3" aria-labelledby="gwt-uid-2" tabindex="0" dir="" style="width: 100%;">

<div class="v-filterselect-button" aria-hidden="true" role="button"></div></div>

My code 

$sTouche =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='gwt-uid-3']")
    _WD_ElementAction($sSession, $sTouche, 'property','')
_ChromeSetInputValueById($sSession,'gwt-uid-3','English')

And the debugger 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element; $sData={"using":"xpath","value":"//input[@id='gwt-uid-3']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element/5472b4ed-0b82-4bf2-b75f-4fbde4f8a117/property/
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element; $sData={"using":"xpath","value":"//input[@id='gwt-uid-3']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element/5472b4ed-0b82-4bf2-b75f-4fbde4f8a117/value; $sData={"id":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117", "text":"English"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
+>15:21:34 AutoIt3.exe ended.rc:0
+>15:21:34 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 22.66

Beforei have "Deutsch" in the input and after i have DeutschEnglish in the fields 
 

Edited by loulou2522
Link to post
Share on other sites

@nguyenthaiytcc This isn't something that I've needed to do previously, but I believe this would be the basic syntax --

$sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE00F"}, {"type": "keyUp", "value": "\uE00F"}]}]}'
_WD_Action($sSession, "actions", $sAction)

Please give it a try and report back with your results.

Link to post
Share on other sites

@loulou2522 I suggest that you post a short reproducer that we can actually run to observe whatever issue you are encountering.

P.S. No idea what the 2nd line is supposed to be doing. If you are attempting to clear the prior value, this this would make more sense --

_WD_ElementAction($sSession, $sTouche, 'clear')

 

Link to post
Share on other sites
$sSession = _WD_CreateSession($sDesiredCapabilities)
;_WD_Window($sSession, 'Maximize')
_WD_Navigate($sSession,"https://ubs-paymentstandards.ch/login")
Sleep(1000)

$sTouche =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='gwt-uid-3']")
    _WD_ElementAction($sSession, $sTouche, 'clear')
    Sleep(2000)
_ChromeSetInputValueById($sSession,'gwt-uid-3','English')

Sleep(1000)
exit

Here is the code to reproduce this case . Hope it will be suffisant for you to show the problem
 

Link to post
Share on other sites
On 11/29/2019 at 5:03 PM, Letraindusoir said:

An error occurred after running the above code.....

hello @Letraindusoir, your code snippet works properly here, (win 7 x64 & ie 11) have you solved your problem?

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to post
Share on other sites

@loulou2522 This isn't a standard web element, so it takes multiple steps to accomplish your goal. The follow example will open the web page and then switch back and forth between English and Deutsch.

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

Local $sDesiredCapabilities
Local $sSession, $sElement, $sElement2

SetupChrome()
_WD_Startup()

If @error <> $_WD_ERROR_Success Then
    Exit -1
EndIf

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession,"https://ubs-paymentstandards.ch/login")
Sleep(1000)

; Click arrow to open dropdown list
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='v-filterselect-button']")
_WD_ElementAction($sSession, $sElement, 'click')

; Wait for element to be present and then click it
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'English')]", 1000)
$sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'English')]")
_WD_ElementAction($sSession, $sElement2, 'click')

Sleep(2500)

; Click arrow to open dropdown list
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='v-filterselect-button']")
_WD_ElementAction($sSession, $sElement, 'click')

; Wait for element to be present and then click it
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Deutsch')]", 1000)
$sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Deutsch')]")
_WD_ElementAction($sSession, $sElement2, 'click')


Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"excludeSwitches": ["enable-automation"]}}}}'
EndFunc

 

Link to post
Share on other sites
15 hours ago, Chimp said:

hello @Letraindusoir, your code snippet works properly here, (win 7 x64 & ie 11) have you solved your problem?

Yes, I can now run it correctly by searching for relevant information. However, the IE browser needs to be set in advance.„Äā

The Configuration Required are as follows:

Quote
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For Windows 10, you also need to set "Change the size of text, apps, and other items" to 100% in display settings.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

 

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By corvo
      Hello!

      I've been trying to launch chrome through WD,  but for some reason, the user profile is not working, it just opens up the chrome window with the "temp" user. I've also made sure that the user profile path is correct by using "chrome://version". 
      Here is what I've got so far:
      #include "wd_helper.au3" #include "wd_capabilities.au3" #include "wd_core.au3" SetupChrome() _WD_CapabilitiesStartup() Local $sCapabilities = _WD_CapabilitiesGet() $sSession = _WD_CreateSession($sCapabilities) _WD_Navigate($sSession, "https://www.google.com") Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') _WD_Option('DriverParams', '--marionette-port 2828') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Profile 2"]}}}}' $_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error EndFunc  
      Thanks in advance!
       
    • By ThomasBennett
      Good morning, everyone, 
      I have had very good luck with using _WD_ElementActionEx 'CLICKANDHOLD'. What would be the best practice with dragging and dropping web elements? I would prefer to not to have to use any dragging and dropping but I haven't figured out a way to change the order the elements are displayed programmatically. 
      I have a list of elements that are drag and drop. These elements in code are using <UL></UL> for the entire list and the actual web elements that are being manipulated are in <LI></LI> tags. These do not look like a bulleted list but that is the code that is being used. I've spoken with the web developer and there isn't any hot keys or keyboard commands that can be used to move these elements.
      I know where the new and original web element appears and can select them using the _WD_WaitElement and _WD_FindElement combo. I can find the number of items in the list by looking at the code; I haven't started pulling the values out just yet. I am trying to figure out if there is a place to change the listed order.
      Using the 'CLICKANDHOLD' feature as part of _WD_ElementActionEx does work and I know more or less where I need to drop it the new web element; the problem I am having is scrolling exactly to where I need the new web element dropped. It should be dropped beneath the original web element. 
      What's the best method to output the number of children associated with the <UL></UL>? I am guessing that _WD_ElementActionEx 'CHILDCOUNT' would be it; but I haven't figured out how to get the call to output in a msgbox or in the console. 
      #cs ---------------------------------------------------------------- Name ..........: Please Note!.au3 Description ...: To be used to add new lessons to existing playlists and to update the pre-existing lesson with the Please Note! PowerPoint SciTE 32-bit ..: Version 4.4.6 Author(s) .....: Thomas E. Bennett Date ..........: 20220929 Recommended Reading / Requirements https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-01162021/#comments https://www.autoitscript.com/wiki/WebDriver https://www.autoitscript.com/wiki/WebDriver#Installation https://www.autoitscript.com/wiki/Adding_UDFs_to_AutoIt_and_SciTE https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine wd_core.au3 wd_helper.au3 From wd_core.au3 Global Const $_WD_LOCATOR_ByCSSSelector = "css selector" Global Const $_WD_LOCATOR_ByXPath = "xpath" Global Const $_WD_LOCATOR_ByLinkText = "link text" Global Const $_WD_LOCATOR_ByPartialLinkText = "partial link text" Global Const $_WD_LOCATOR_ByTagName = "tag name" #ce ---------------------------------------------------------------- #include "wd_core.au3" #include "wd_helper.au3" #include <MsgBoxConstants.au3> #include <Excel.au3> #include <AutoItConstants.au3> Local $sDesiredCapabilities, $sSession, $sElement ; Create application object and open an example workbook Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\{PRIVACY}.xlsx") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\{PRIVACY}.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf ; Read data from a single cell on the active sheet of the specified workbook ;Local $sResult = _Excel_RangeRead($oWorkbook, Default, "A1") ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Data successfully read." & @CRLF & "Value of cell A1: " & $sResult) SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) Sleep (15000) Local $aResult = _Excel_RangeRead($oWorkbook, Default, "A16:E16") For $i = 0 To UBound($aResult, 1) - 1 ;ConsoleWrite("========= Start Row =========" & @CRLF) ;ConsoleWrite($aResult[$i][0] & @CRLF) ; Column A -- Course Playlist Number ;ConsoleWrite($aResult[$i][1] & @CRLF) ; Column B -- Course Playlist Title ;ConsoleWrite($aResult[$i][2] & @CRLF) ; Column C -- Original Lesson Title ;ConsoleWrite($aResult[$i][3] & @CRLF) ; Column D -- Updated Lesson Number ;ConsoleWrite($aResult[$i][4] & @CRLF) ; Column E -- Updated Lesson Title ;ConsoleWrite("========= End Row =========" & @CRLF & @CRLF) _WD_Navigate($sSession, "{PRIVACY}" & $aResult[$i][0]) _WD_LoadWait($sSession, 2000) ; Find the Available Lessons search box and enter the appropriate value _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='titleSearch']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='titleSearch']") ; Click the Sign in button _WD_ElementAction($sSession, $sElement, 'value', $aResult[$i][3]) Send("{Enter}") ; Find the correct "Add" hyperlink _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text()='" & $aResult[$i][4] & "']/following-sibling::div") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text()='" & $aResult[$i][4] & "']/following-sibling::div") ; Click the "Add" hyperlink _WD_ElementAction($sSession, $sElement, 'click') ; Number of Child Elements _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']") _WD_ElementActionEx($sSession, $sElement, 'CHILDCOUNT') Exit ; Click and Hold the appropriate element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/parent::li") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/parent::li") _WD_ElementActionEx($sSession, $sElement, 'clickandhold', 0, 0, 0, 10000) ; Hover the appropriate element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/following-sibling::a") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/following-sibling::a") _WD_ElementActionEx($sSession, $sElement, 'HOVER') Exit Next Exit _WD_DeleteSession($sSession) _WD_Shutdown() Exit Func SetupChrome() ; Google Chrome _WD_Option('Driver', "C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe") _WD_Option('Port', 9515) ;_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false},' & _ '"args": ["start-maximized"] }}}}' EndFunc Console Output
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3" /UserParams +>09:22:40 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\thomas.bennett\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\thomas.bennett\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3 +>09:22:40 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. _WD_Option ==> Success [0] : Parameters: Option=Driver Value=C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 22000 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.10.1 (Up to date) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 9515 _WD_Startup: Command: "C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe" _WD_Startup ==> Success [0] __WD_Post ==> Success [0] : HTTP status = 200 _WD_CreateSession ==> Success [0] : 2542b35e47b8f9b2558cd92ad1418811 __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Username'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Username'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Password'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Password'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@value='Sign In'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@value='Sign In'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=click Option=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='titleSearch'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='titleSearch'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Timeout [7] : Parameters: Strategy=xpath Selector=//span[text()='{PRIVACY}']/following-sibling::div Delay=Default Timeout=Default Options=Default __WD_Post ==> No match [8] : HTTP status = 404 _WD_FindElement ==> No match [8] : Parameters: Strategy=xpath Selector=//span[text()='{PRIVACY}']/following-sibling::div StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> No match [8] : HTTP status = 404 _WD_ElementAction ==> No match [8] : Parameters: Command=click Option=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//ul[@id='selected-items'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//ul[@id='selected-items'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ExecuteScript ==> Success [0] _WD_ElementActionEx ==> Success [0] : Parameters: Element=21c01052-8b86-4058-b8f6-d9dfa750f9ee Command=CHILDCOUNT XOffset=Default YOffset=Default Button=Default HoldDelay=Default Modifier=Default +>09:23:20 AutoIt3.exe ended.rc:0 +>09:23:20 AutoIt3Wrapper Finished. >Exit code: 0 Time: 40.88  

      My thought is once AutoIt knows how many child elements there are; I am hoping that there would be a way to change the sort or priority order that the <LI></LI>'s are shown in. 
      Thank you for your time and efforts on this and as I progress I'll update this topic, 




      Thomas 
    • By ThomasBennett
      #cs ---------------------------------------------------------------- Name ..........: ignore.au3 Description ...: Testing _WD_HighlightElements SciTE 32-bit ..: Version 4.4.6 Author(s) .....: Thomas E. Bennett Date ..........: 20220929 Recommended Reading / Requirements https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-01162021/#comments https://www.autoitscript.com/wiki/WebDriver https://www.autoitscript.com/wiki/WebDriver#Installation https://www.autoitscript.com/wiki/Adding_UDFs_to_AutoIt_and_SciTE https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine wd_core.au3 wd_helper.au3 From wd_core.au3 Global Const $_WD_LOCATOR_ByCSSSelector = "css selector" Global Const $_WD_LOCATOR_ByXPath = "xpath" Global Const $_WD_LOCATOR_ByLinkText = "link text" Global Const $_WD_LOCATOR_ByPartialLinkText = "partial link text" Global Const $_WD_LOCATOR_ByTagName = "tag name" #ce ---------------------------------------------------------------- #include "wd_core.au3" #include "wd_helper.au3" #include "wd_cdp.au3" #include "wd_capabilities.au3" #include <MsgBoxConstants.au3> Local $sDesiredCapabilities, $sElement, $sSession Func SetupChrome() ; Google Chrome _WD_Option('Driver', @ScriptDir & "\include\chromedriver.exe") _WD_Option('Port', 9515) ;_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false},' & _ '"args": ["start-maximized"] }}}}' EndFunc SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) Sleep (15000) ; DuckDuckGo _WD_Navigate($sSession, "https://duckduckgo.com/") _WD_LoadWait($sSession, 2000) ; Find the Search field _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='search_form_input_homepage']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='search_form_input_homepage']") ; Highlight the Search field _WD_HighlightElements($sSession, $sElement, 3) MsgBox(0,"","") Exit ;this is here on purpose _WD_DeleteSession($sSession) _WD_Shutdown() Exit Good evening, everyone, 
      I am trying to get any element to highlight using the _WD_HighlightElements function; I've tried different elements and for a time I thought maybe because I am working in Windows 11 so I switched back to Windows 10 same issue; I can't get the found element to highlight. What am I doing incorrectly?
      Console Output _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/0e05f8ea99dba06bb84908b0b46fe881/element; $sData={"using":"xpath","value":"//input[@id='search_form_input_homepage']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}} Thank you for your time on this,




      Thomas E. Bennett
    • By SkysLastChance
      I am having trouble finding a good way to click these "button" below. 

      I only need to be able to click them when they have both yes/no. Otherwise I don't have to worry about them. For instance if they looked like this I would NOT have worry about clicking them and can just ignore them all togheter.(Below Picture)

      The problem is as mentioned in the title, all of the ID's  are dynamic. (Classes too)

      Here is what it looks like if yes is already selected.

      This is what I was using to select the the button. However, I need to know if the button has already been clicked/selected or not.
      _WD_LoadWait($sSession) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text() = 'Offered access to electronic health information?']") Sleep(1000) _WD_ElementAction($sSession, $sElement, 'click') Sleep(500) _WD_Action($sSession, "actions", $sActionTab) Sleep(500) _WD_Action($sSession, "actions", $sActionEnter) Is there a way I can get the count of spans in the span class-"s_636" by tabbing over to the button? I am hoping someone might have some ideas on what I can try.
      Unfortunally, The site is for work so giving the site wont do any good. 
    • By ThomasBennett
      Good morning, everyone, 
      I am using WebDriver with ChromeDriver version 105.0.5195.52
      I have the script almost completed; this is going to be used as a wait / pause until the file has completed uploading. I was able to find where the value: "C:\\fakepath\\Vladimir Harkonnen.jpg" is stored. I am trying to figure out how to read this value. This is part of an <input type="file"> element. Reading / finding the value would be the trigger to allow the script to continue. I don't know very much but I feel like I am either not using WebDriver correctly or possibly it won't be able to help me with what I am trying to do.
      Please see the attached screenshot. 
      Thank you for your time, experience, and patience with me,




      Thomas Bennett
       

×
×
  • Create New...