Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

I think that _WD_Status() is not useful. It returns  

{"value":{"build":{"version":"91.0.4472.19 (1bf021f248676a0b2ab3ee0561d83a59e424c23e-refs/branch-heads/4472@{#288})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Windows NT","version":"10.0.19042"},"ready":true}}   and   error=0

And I believe that it is an issue and not a feature 🙃 

My workaround:

Func _CheckSession($sHandle)
    Local $aHandles =_WD_Window($sSession, "handles")
    If UBound($aHandles) = 0 Then                                                                   ; if all windows discarded
        _WD_DeleteSession($sSession)                                                                ;   delete old session
        $sSession = _WD_CreateSession($sDesiredCapabilities)                                        ;   create new session
    ElseIf _ArraySearch($aHandles, $sHandle) = -1 Then                                              ; else if last handle not found
        _WD_Window($sSession, 'Switch', '{"handle":"' & $aHandles[UBound($aHandles) - 1] & '"}')    ;   switch to handle before
    EndIf
EndFunc

Func _NewWindow($sHandleOld = "")
    _CheckSession($sHandleOld)
    Return _WD_Window($sSession, 'new', '{"type":"window"}')
EndFunc

 

Link to comment
Share on other sites

1 hour ago, Danp2 said:

Sorry you feel that way. FWIW, here's the correct way to use it --

$oStatus = _WD_Status()

If IsObj($oStatus) Then
    ConsoleWrite("Status = " & $oStatus.Item('message') & " / " & $oStatus.Item('ready') & @CRLF)
EndIf

 

That doesn't help in this case 🙃 With "And I believe that it is an issue and not a feature" I do not mean _WD_Status() but the problem with _WD_Window($sSession, 'new', '{"type":"window"}')

As I wrote before: with our problem _WD_Window($sSession, 'new', '{"type":"window"}' and discarded windows _WD_Status()  always responds "ChromeDriver ready for new sessions. / True" even if we close all windows before. So _WD_Status() doesn't help for this problem.

In the moment I see only the workaround with handles as an idea and that _WD_Status() doesn't notice the problem makes me sure that the problem with the discarded windows is a bug and not a feature.

Edited by HJL
Link to comment
Share on other sites

Hello Danp2,
first of all thanks for creating the UDF.
I am creating a PLC program which acts as a real machine so a PLC program on an other PLC for a real machine could be tested before the machine is build up. My simulation PLC program contains a web based visualization with which I control the simulation, e.g. "open a door", trigger a smoke detector. Now automated tests should be created and that's why I want to use AutiIt and your UDF, but how?
Is there any documentation? First of all I think I must find all the controls (e.g. Buttons) in the visualization, so I can use them.

Link to comment
Share on other sites

Hi Dan,
hi community.

I am currently building a script to get a text out of this website (https://binary-signal.com/en)

This code I already tried out to locate the text passage:

first try:

$sElementSelector = "//text[@class='y2']"
$sElement = _WD_FindElement($sSession3, $_WD_LOCATOR_ByXPath, $sElementSelector)
$feed1 = _WD_ElementAction($sSession3, $sElement, 'Text') 
;optional: $feed1 = _WD_ElementAction($sSession3, $sElement, 'property', 'innerText')

second try:

$sElementSelector = "//*[@id='chart']/svg/g/g[7]/text[1]"
$sElement = _WD_FindElement($sSession3, $_WD_LOCATOR_ByXPath, $sElementSelector)
$feed1 = _WD_ElementAction($sSession3, $sElement, 'Text') ;optional: $feed1 = _WD_ElementAction($sSession3, $sElement, 'property', 'innerText')


This is the element itself. I want to get (for example an active put signal)

<text class="y2" fill="white" font-weight="bold" dx="10" dy="17" transform="translate(634,233.2343750000061)">1.21844 PUT</text>

The xpath:

//*[@id="chart"]/svg/g/g[7]/text[1]

The full xpath:

/html/body/div[2]/div[2]/div[2]/div/svg/g/g[7]/text[1]

I tried different variantes and also tried to find out if the content is within another iframe. 

Scite console:
WD_ExecuteScript: {"value":6}...
Frames=6

I also gone through all 6 frames to find the element. But no hit.

$sFrame = _WD_FindElement($sSession3, $_WD_LOCATOR_ByXPath, "//iframe[1]")
_WD_FrameEnter($sSession3, $sFrame)

.... my code to find the element ....

$sFrame = _WD_FindElement($sSession3, $_WD_LOCATOR_ByXPath, "//iframe[2]")
_WD_FrameEnter($sSession3, $sFrame)

.... etc....

This is the output in the console

Spoiler

__WD_Post: URL=HTTP://127.0.0.1:9515/session/69ee65f64e942279b016fa8c3489bcc1/element; $sData={"using":"xpath","value":"//iframe[1]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"85f7ec2b-8b3d-479b-9580-ce650e1d534b"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"85f7ec2b-8b3d-479b-9580-ce650e1d534b"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/69ee65f64e942279b016fa8c3489bcc1/frame; $sData={"id":{"element-6066-11e4-a52e-4f735466cecf":"85f7ec2b-8b3d-479b-9580-ce650e1d534b"}}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/69ee65f64e942279b016fa8c3489bcc1/element; $sData={"using":"xpath","value":"//text[@class='y2']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//text[@class='y2']\"}\n  (Session info: chrome=88.0.4324.104)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0072B963+483]\n\tGetHandleVerifier [0x0072B941+449]\n\tGetHandleVerifier [0x00AD3308+3832712]\n\tGetHandleVerifier [0x00AF61C4+3975748]\n\tGetHandleVerifier [0x00B18822+4116642]\n\tGetHandleVerifier [0x00B0B43A+4062394]\n\tGetHandleVerifier [0x00B17159+4110809]\n\tGetHandleVerifier [0x00B0B2EB+4062059]\n\tGetHandleVerifier [0x00AEED14+3945876]\n\tGetHandleVerifier [0x00AEFBCE+3949646]\n\tGetHandleVerifier [0x00AEFB59+3949529]\n\tOrdinal0 [0x006EB5CC+46540]\n\tOrdinal0 [0x006E9F53+40787]\n\tOrdinal0 [0x006E9B12+39698]\n\tGetHandleVerifier [0x009F1468+2907368]\n\tGetHandleVerifier [0x008371EE+1096302]\n\tGetHandleVerifier [0x007F3E8D+821005]\n\tGetHandleVerifier [0x007F396B+819691]\n\tGetHandleVerifier [0x007F3881+819457]\n\tGetHandleVerifier [0x0081F463+998627]\n\tBaseThreadInitThunk [0x74FFFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77177A7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77177A4E+238]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//text[@class='y2']\"}\n  (Session info: chrome=88.0.4324.104)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0072B963+483]\n\tGetHandleVerifier [0x0072B941+449]\n\tGetHandleVerifier [0x00AD3308+3832712]\n\tGetHandleVerifier [0x00AF61C4+3975748]\n\tGetHandleVerifier [0x00B18822+4116642]\n\tGetHandleVerifier [0x00B0B43A+4062394]\n\tGetHandleVerifier [0x00B17159+4110809]\n\tGetHandleVerifier [0x00B0B2EB+4062059]\n\tGetHandleVerifier [0x00AEED14+3945876]\n\tGetHandleVerifier [0x00AEFBCE+3949646]\n\tGetHandleVerifier [0x00AEFB59+3949529]\n\tOrdinal0 [0x006EB5CC+46540]\n\tOrdinal0 [0x006E9F53+40787]\n\tOrdinal0 [0x006E9B12+39698]\n\tGetHandleVerifier [0x009F1468+2907368]\n\tGetHandleVerifier [0x008371EE+1096302]\n\tGetHandleVerifier [0x007F3E8D+821005]\n\tGetHandleVerifier [0x007F396B+819691]\n\tGetHandleVerifier [0x007F3881+819457]\n\tGetHandleVerifier [0x0081F463+998627]\n\tBaseThreadInitThunk [0x74FFFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77177A7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77177A4E+238]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Get: URL=HTTP://127.0.0.1:9515/session/69ee65f64e942279b016fa8c3489bcc1/element//text
__WD_Get: StatusCode=404; $iResult = 8; $sResponseText={"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
__WD_Get ==> No match: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=88.0.4324.104)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0072B963+483]\n\tGetHandleVerifier [0x0072B941+449]\n\tGetHandleVerifier [0x00AD3308+3832712]\n\tGetHandleVerifier [0x00AF5A88+3973896]\n\tGetHandleVerifier [0x00AF31F4+3963508]\n\tGetHandleVerifier [0x00B0B403+4062339]\n\tGetHandleVerifier [0x00AEFFB6+3950646]\n\tGetHandleVerifier [0x00B0B4CA+4062538]\n\tGetHandleVerifier [0x00B17159+4110809]\n\tGetHandleVerifier [0x00B0B2EB+4062059]\n\tGetHandleVerifier [0x00AEED14+3945876]\n\tGetHandleVerifier [0x00AEFBCE+3949646]\n\tGetHandleVerifier [0x00AEFB59+3949529]\n\tOrdinal0 [0x006EB5CC+46540]\n\tOrdinal0 [0x006E9F53+40787]\n\tOrdinal0 [0x006E9B12+39698]\n\tGetHandleVerifier [0x009F1468+2907368]\n\tGetHandleVerifier [0x008371EE+1096302]\n\tGetHandleVerifier [0x007F3E8D+821005]\n\tGetHandleVerifier [0x007F396B+819691]\n\tGetHandleVerifier [0x007F3881+819457]\n\tGetHandleVerifier [0x0081F463+998627]\n\tBaseThreadInitThunk [0x74FFFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77177A7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77177A4E+238]\n"}}
_WD_ElementAction: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_ElementAction ==> No match: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=88.0.4324.104)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0072B963+483]\n\tGetHandleVerifier [0x0072B941+449]\n\tGetHandleVerifier [0x00AD3308+3832712]\n\tGetHandleVerifier [0x00AF5A88+3973896]\n\tGetHandleVerifier [0x00AF31F4+3963508]\n\tGetHandleVerifier [0x00B0B403+4062339]\n\tGetHandleVerifier [0x00AEFFB6+3950646]\n\tGetHandleVerifier [0x00B0B4CA+4062538]\n\tGetHandleVerifier [0x00B17159+4110809]\n\tGetHandleVerifier [0x00B0B2EB+4062059]\n\tGetHandleVerifier [0x00AEED14+3945876]\n\tGetHandleVerifier [0x00AEFBCE+3949646]\n\tGetHandleVerifier [0x00AEFB59+3949529]\n\tOrdinal0 [0x006EB5CC+46540]\n\tOrdinal0 [0x006E9F53+40787]\n\tOrdinal0 [0x006E9B12+39698]\n\tGetHandleVerifier [0x009F1468+2907368]\n\tGetHandleVerifier [0x008371EE+1096302]\n\tGetHandleVerifier [0x007F3E8D+821005]\n\tGetHandleVerifier [0x007F396B+819691]\n\tGetHandleVerifier [0x007F3881+819457]\n\tGetHandleVerifier [0x0081F463+998627]\n\tBaseThreadInitThunk [0x74FFFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77177A7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77177A4E+238]\n"}}

Thanks for any help and suggestion.

greetings

PaddyHeady

 

 

1.PNG

Edited by PaddyHeady
Link to comment
Share on other sites

3 hours ago, OliverTonn said:

Now automated tests should be created and that's why I want to use AutiIt and your UDF, but how? Is there any documentation? First of all I think I must find all the controls (e.g. Buttons) in the visualization, so I can use them.

You have several resources available to you --

  • wd_demo.au3 is intended to demonstrate some of the basic usage
  • Wiki page, which is community maintained, gives a good overview of the UDF functionality
  • This forum where you will find multiple threads related to the UDF usage
  • W3C specs, which is he ultimate guide for how each Webdriver call is supposed to work

Good luck!

DanP

Link to comment
Share on other sites

@PaddyHeadyBased upon minimal research, it appears that you can't use an SVG in the xpath. However, this xpath seems to work to obtain the SVG element --

//div[@id='chart']/*

Not sure if you can retrieve the desired element with a single call to _WD_FindElement or if it will take multiple function calls.

Link to comment
Share on other sites

I started to create a script, but when creating a session error messages occur.

__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData=
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stack...
__WD_Post ==> Invalid argument: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF6B81F5F92+4677522]\n\tOrdinal0 [0x00007FF6B7E9D577+1168759]\n\tOrdinal0 [0x00007FF6B7EED240+1495616]\n\tOrdinal0 [0x00007FF6B7E77F89+1015689]\n\tOrdinal0 [0x00007FF6B7F70EB1+2035377]\n\tOrdinal0 [0x00007FF6B7F3C72E+1820462]\n\tOrdinal0 [0x00007FF6B8113504+3749124]\n\tOrdinal0 [0x00007FF6B7F3D0FE+1822974]\n\tOrdinal0 [0x00007FF6B8208B54+4754260]\n\tOrdinal0 [0x00007FF6B7E77492+1012882]\n\tOrdinal0 [0x00007FF6B811DCA8+3792040]\n\tBaseThreadInitThunk [0x00007FF9E9697C24+20]\n\tRtlUserThreadStart [0x00007FF9EAECD721+33]\n"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF6B81F5F92+4677522]\n\tOrdinal0 [0x00007FF6B7E9D577+1168759]\n\tOrdinal0 [0x00007FF6B7EED240+1495616]\n\tOrdinal0 [0x00007FF6B7E77F89+1015689]\n\tOrdinal0 [0x00007FF6B7F70EB1+2035377]\n\tOrdinal0 [0x00007FF6B7F3C72E+1820462]\n\tOrdinal0 [0x00007FF6B8113504+3749124]\n\tOrdinal0 [0x00007FF6B7F3D0FE+1822974]\n\tOrdinal0 [0x00007FF6B8208B54+4754260]\n\tOrdinal0 [0x00007FF6B7E77492+1012882]\n\tOrdinal0 [0x00007FF6B811DCA8+3792040]\n\tBaseThreadInitThunk [0x00007FF9E9697C24+20]\n\tRtlUserThreadStart [0x00007FF9EAECD721+33]\n"}}
_WD_CreateSession ==> Webdriver Exception: HTTP status = 400
 

Here is my code
 

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:         Oliver Tonn

 Script Function:
    Test PlasmaPQ

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include "wd_core.au3"
#include "wd_helper.au3"
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>

Main()

Func Main()

Local $sDesiredCapabilities, $sSession
Local $nMsg

   ; List of tests
   Local $aTests[][2] = _
           [["TMA", False], _
           ["Door Alarms", True]]

   Local $iSpacing = 50

   Local $iTestCnt = UBound($aTests) ; Determine number of tests
   Local $aTestChoice[$iTestCnt]

   Local $hGUI = GUICreate("PlasmaPQ Tests", 200, 150 + (20 * $iTestCnt), 100, 200, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))

   GUICtrlCreateLabel("Tests:", 15, 52)

   For $i = 0 To $iTestCnt - 1
       $aTestChoice[$i] = GUICtrlCreateRadio($aTests[$i][0], 70, $iSpacing + (20 * $i), 100, 17, $GUI_SS_DEFAULT_RADIO)
       If $aTests[$i][1] Then GUICtrlSetState($aTestChoice[$i], $GUI_CHECKED)
   Next

   Local $iPos = $iSpacing + 20 * ($iTestCnt + 1)

   Local $idBtnStartTest = GUICtrlCreateButton("Run Test", 60, $iPos + 40, 85, 25)

   GUISetState(@SW_SHOW)

   While 1
      While 1
          $nMsg = GUIGetMsg()
          Switch $nMsg
            Case $GUI_EVENT_CLOSE
               ExitLoop 2
            Case $idBtnStartTest
               SetupEdge()
               _WD_Startup()
               If @error <> $_WD_ERROR_Success Then
                  Exit -1
               EndIf
               $sSession = _WD_CreateSession($sDesiredCapabilities)
               If @error = $_WD_ERROR_Success Then
                  _WD_Navigate($sSession, "http://www.is-tonn.de")
                  ExitLoop
               Else
                  _WD_Shutdown()
                  Exit -1
               EndIf
          EndSwitch
      WEnd
       $nMsg = GUIGetMsg()
       Switch $nMsg
         Case $GUI_EVENT_CLOSE
            _WD_DeleteSession($sSession)
            _WD_Shutdown()
            ExitLoop
      EndSwitch
   WEnd

GUIDelete($hGUI)

EndFunc

Func SetupEdge()
    _WD_Option('Driver', 'msedgedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}'
EndFunc   ;==>SetupEdge

I took a brief search on google, but didn't find an answer.

Link to comment
Share on other sites

@OliverTonnYou have encountered a variable scoping issue. The variable $sDesiredCapabilities is blank after returning from SetupEdge because is was declared local to Main. Easiest solution is to declare the variable as Global instead of Local.

P.S. You can use ConsoleWrite commands to help you identify bugs like this.

Link to comment
Share on other sites

I am currently learning AutoIt.

I am making a demo to automate some of the tasks on our company's Web Application.

The Process is: Open Browser > Open Website > Login > Go to Processes tab > Click on a Process, system will open the process page > Input value and submit.

Right now, I stuck at "Click on a Process" step. On the web page, if I click on a row, a webpage of the process of the row will be opened. But the AutoIt unable to click on it, with error message as "element not interactable".

I included the screenshot of the process web page and underline html below.

The code I use is:

Const $vTask = '入庫データ取込エラー対応'
$sRowTask = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//td[contains(text(),$vTask)]")
If @error = $_WD_ERROR_Success Then
   _WD_ElementAction($sSession, $sRowTask, "Click")
EndIf

The _WD_FindElement punction was success, but the "Click" action is not.

The log is as below:

__WD_Post: URL=HTTP://127.0.0.1:9515/session/5eb101046f699dd5349914c3f90b35b9/element; $sData={"using":"xpath","value":"//td[contains(text(),$vTask)]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"e76a590f-b2e6-48fb-8eae-a0f56aeb4ff2"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"e76a590f-b2e6-48fb-8eae-a0f56aeb4ff2"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5eb101046f699dd5349914c3f90b35b9/element/e76a590f-b2e6-48fb-8eae-a0f56aeb4ff2/click; $sData={"id":"e76a590f-b2e6-48fb-8eae-a0f56aeb4ff2"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: c...
__WD_Post ==> Element interaction issue: {"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: chrome=91.0.4472.77)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00F72DB3+2502067]\n\tOrdinal0 [0x00F0C5B1+2082225]\n\tOrdinal0 [0x00E12360+1057632]\n\tOrdinal0 [0x00E3DB16+1235734]\n\tOrdinal0 [0x00E33627+1193511]\n\tOrdinal0 [0x00E55D23+1334563]\n\tOrdinal0 [0x00E33446+1193030]\n\tOrdinal0 [0x00E55E0A+1334794]\n\tOrdinal0 [0x00E64B7B+1395579]\n\tOrdinal0 [0x00E55BEB+1334251]\n\tOrdinal0 [0x00E32174+1188212]\n\tOrdinal0 [0x00E33009+1191945]\n\tGetHandleVerifier [0x010EEC5C+1511084]\n\tGetHandleVerifier [0x01198522+2205554]\n\tGetHandleVerifier [0x00FF3393+480739]\n\tGetHandleVerifier [0x00FF2579+477129]\n\tOrdinal0 [0x00F11E5D+2104925]\n\tOrdinal0 [0x00F163F8+2122744]\n\tOrdinal0 [0x00F16537+2123063]\n\tOrdinal0 [0x00F1EE53+2158163]\n\tBaseThreadInitThunk [0x770EFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x777D7A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x777D7A6E+238]\n"}}
_WD_ElementAction: {"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: c...
_WD_ElementAction ==> Element interaction issue: {"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: chrome=91.0.4472.77)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00F72DB3+2502067]\n\tOrdinal0 [0x00F0C5B1+2082225]\n\tOrdinal0 [0x00E12360+1057632]\n\tOrdinal0 [0x00E3DB16+1235734]\n\tOrdinal0 [0x00E33627+1193511]\n\tOrdinal0 [0x00E55D23+1334563]\n\tOrdinal0 [0x00E33446+1193030]\n\tOrdinal0 [0x00E55E0A+1334794]\n\tOrdinal0 [0x00E64B7B+1395579]\n\tOrdinal0 [0x00E55BEB+1334251]\n\tOrdinal0 [0x00E32174+1188212]\n\tOrdinal0 [0x00E33009+1191945]\n\tGetHandleVerifier [0x010EEC5C+1511084]\n\tGetHandleVerifier [0x01198522+2205554]\n\tGetHandleVerifier [0x00FF3393+480739]\n\tGetHandleVerifier [0x00FF2579+477129]\n\tOrdinal0 [0x00F11E5D+2104925]\n\tOrdinal0 [0x00F163F8+2122744]\n\tOrdinal0 [0x00F16537+2123063]\n\tOrdinal0 [0x00F1EE53+2158163]\n\tBaseThreadInitThunk [0x770EFA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x777D7A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x777D7A6E+238]\n"}}

I try the below, the result is success, but the row was still not being clicked.

_WD_ElementActionEx($sSession, $sRowTask, "doubleclick")

I wonder if Autoit is unable to click on the row because it is not button or link?

Can anyone help me on this?

Process_page.png

Process_page_html.png

Link to comment
Share on other sites

Hello community,
I must admit it, I don't know what I'm doing.
I'm writing a script which should control the following webpage:
WebVisu.thumb.png.60132383c2fa74499af5d9ae809cfb58.png

I would like to click on the marked object.
By the way, how would be the best way to get the necessary data of certain objects to control them?
Thanks in advance.

 

Link to comment
Share on other sites

2 hours ago, Prospekt said:

Const $vTask = '入庫データ取込エラー対応'

$sRowTask = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//td[contains(text(),$vTask)]")

On initial glance, this is where I think your issue resides. Whatever element is being found is the wrong one because you aren't using the correct xpath. If you want to use a variable to store a portion of the xpath, then you need to concatenate it to the rest of your xpath string --

Const $vTask = '入庫データ取込エラー対応'
$sRowTask = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//td[contains(text()," & $vTask & ")]")

HTH, Dan

Link to comment
Share on other sites

1 hour ago, Danp2 said:

@OliverTonnYou will need to become familiar with the browser's Developer Tools. You can access them by pressing the F12 key. I suggest that you also take a look at ChroPath, which is a browser extension that will help with obtaining the correct xpath.

OK, thanks again. So if I'm right, I have to determine the xpath of each element I want to control and then use the data to control it. I took a look at ChroPath on an other system and I think I found the XPATH. My problem now is, that the system on which I must use it has no internet connection and till now I can't find the offline installer for ChroPath. I already sent the developer an emai.

Link to comment
Share on other sites

3 minutes ago, Danp2 said:

@OliverTonnYou haven't told us much about the site you are wanting to automate. You may have some difficulties if it's a Java app being loaded in the browser.

OK, sorry, my fault. Its a "automaticly" generated webpage. It is created by the PLC development system TwinCAT 3 from Beckhoff and as far as if I'm correct it is a HTML 5 page only with Java script.
It should be used to change certain states of a simulated machine, like door is open, smoke detector triggered, and so on.

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