Jump to content

WebDriver UDF - Help & Support


Recommended Posts

Hello everyone! I just started to learn webdriver and I like it very much. I came across a problem or problems that I can't seem to figured out! I'm trying to click on a couple of checkbox that has the same text element.  This is a class scheduler website. The ID element changes depending on the time availability so it's not reliable. I focus on the text element to get the checkbox selected and it work very well. The problem is that I am unable to select multiple checkbox with the same text element or select the second or third checkbox with the same text element. It seem only the first checkbox is selected.

Here is my code that work to select the checkbox by text.

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]")
    _WD_ElementAction($sSession, $sElement, 'click')

Here is my attempt to select 2 checkbox with the same text element. All it does is uncheck the first checkbox.

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]")
    _WD_ElementAction($sSession, $sElement, 'click')
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]")
    _WD_ElementAction($sSession, $sElement, 'click')

First checkbox...

<div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time">class schedule</div><div class="cx-item-contents"></div><div class="cx-item-contents">10:00 am</div><div class="cx-item-contents">2:00 pm</div><div class="cx-item-contents"></div></div>

<div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox1" class="cx-fa-chk cx-selfschedule-chk" type="checkbox"><label for="cx_checkbox1"></label></div></div>

 

Third checkbox with the same time. Label and ID element always changing..

 

<div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time">class schedule</div><div class="cx-item-contents"></div><div class="cx-item-contents">10:00 am</div><div class="cx-item-contents">2:00 pm</div><div class="cx-item-contents"></div></div>

<div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox5" class="cx-fa-chk cx-selfschedule-chk" type="checkbox"><label for="cx_checkbox5"></label></div></div>

 

If I can select all checkbox with the same text element "10:00 am" that would be amazing!! Even if I can check the second checkbox and not always the first checkbox that has the same text that would help alot. What I'm I missing? Any advised I would appreciated. Thanks in advanced!!!

Link to post
Share on other sites
  • 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

Getting console.log output from Chrome

Hi everybody! As the line above said, I want to get the output from console.log from chrome this is the code that works with "Python" I want the same thing with "Autoit". Please everyone help. sorry about my english.

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time

# enable browser logging
d = DesiredCapabilities.CHROME
d['goog:loggingPrefs'] = {'browser':'ALL'}
driver = webdriver.Chrome(desired_capabilities=d)

# load the desired webpage
driver.get('http://foo.com')
time.sleep(5)

# print messages
for entry in driver.get_log('browser'):
    print(entry)

 

Link to post
Share on other sites
On 9/7/2019 at 8:15 AM, Letraindusoir said:

two small problems are found:

These sound like issues with your script, not the Webdriver UDF. Adding some error checking to your script can address #1. Not sure on #2. Perhaps there's an option you can use when launching the browser to prevent this popup from appearing. Suggest that you research for a solution and then report back here with your findings. :thumbsup:

Link to post
Share on other sites
14 hours ago, Edgar-Nguyen said:

d['goog:loggingPrefs'] = {'browser':'ALL'}

In wd_demo, this is the current desired capacities line for Chrome --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'

To implement the logging, I would try modifying this line to --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}, {"goog:loggingPrefs": {"browser":"ALL"}}}}'

Completely untested, so test away and let us know how it goes.

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

If I can select all checkbox with the same text element "10:00 am" that would be amazing!! Even if I can check the second checkbox and not always the first checkbox that has the same text that would help alot. What I'm I missing?

Check out _WD_FindElement's $lMultiple parameter. Setting it the True will give you a returned array of matching elements.

You could also try the following to retrieve the 2nd instance --

_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')][2]")

 

Link to post
Share on other sites
6 hours ago, Danp2 said:

In wd_demo, this is the current desired capacities line for Chrome --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'

To implement the logging, I would try modifying this line to --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}, {"goog:loggingPrefs": {"browser":"ALL"}}}}'

Completely untested, so test away and let us know how it goes.

Cảm ơn Danp2. nó có thể làm việc với tôi. Nhưng có lẽ điều tôi đang cần là từ dòng CODE này "driver.get_log('browser')" điều gì có thể làm việc với mã của tôi. Và xin lỗi một lần nửa vì tiếng anh của tôi.

Link to post
Share on other sites

Here's the correct format for the desired capabilities to enable logging in Chrome --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }, "goog:loggingPrefs": {"browser":"ALL"}}}}'
On 9/8/2019 at 2:14 AM, Edgar-Nguyen said:

# print messages for entry in driver.get_log('browser'):     print(entry)

Not sure on this. You'll need to research on your own or perhaps someone else will chime in with some thoughts.

P.S. Please keep your responses in English to adhere to the forum policies :thumbsup:

Link to post
Share on other sites

I have another dumb question. How do I get WebDiver to click on image tags?

I want to click on this image tag: <img id="titlebar_hyperlink_8-lbsignout_image" src="btn_signout.gif" class="pwimg" border="0" style="vertical-align:top;margin:0px;margin-left:3px;margin-right:3px;" alt="Sign Out ALT+S">

However when I use This code:

Local $logOut   = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//img[@id='titlebar_hyperlink_8-lbsignout_image']")
_WD_ElementAction($sSession, $logOut, 'click')
Sleep(3000)

nothing happens. 

Link to post
Share on other sites
39 minutes ago, nooneclose said:

This may be the dumbest question you will hear all day, but how do I minimize a website using WebDiver? 

I tried this thinking it would work. 

_WD_Window($sSession, 'minimize')

 

Nothing dumb about the question. However, you need to include more details if you expect others to assist you. Things like --

  • Browser name and version
  • Webdriver name and version
  • Short script demonstrating the issue
  • Results from the Scite console output
  • etc

I went ahead and looked into this for you. AFAICS, the UDF conforms to the W3C specs. However, both Chrome and Firefox didn't recognize the commands. They appears to function correctly in MSEdge.

Link to post
Share on other sites

@Danp2 Thank you for getting back with me so quickly. 

  • Browser name and version - Chrome, Version: 76.0.3809.132 (Official Build) (64-bit)
  • Webdriver name and version - WebDriver-0.1.0.16
  • Short script demonstrating the issue: I posted my whole script. Its only 120 lines (the first 80 are the same as the "demo" script) I basically only edited the two functions navigation and elements. 

      

; Required Files for WebDiver to work
#include "wd_core.au3"
#include "wd_helper.au3"
#include <FileConstants.au3>
;#RequireAdmin                      ;Requests Admin privliges to run

Local Enum $eFireFox = 0, _
            $eChrome, _
            $eEdge

Local $aDemoSuite[][2] = [["DemoTimeouts", False], _
                         ["DemoNavigation", True], _
                         ["DemoElements", True], _
                         ["DemoScript", False], _
                         ["DemoCookies", False], _
                         ["DemoAlerts", False], _
                         ["DemoFrames", False], _
                         ["DemoActions", False], _
                         ["DemoWindows", False]]

Local Const $_TestType = $eChrome
Local Const $sElementSelector = "//input[@name='q']"

Local $sDesiredCapabilities
Local $iIndex
Local $sSession

$_WD_DEBUG = $_WD_DEBUG_Info

Switch $_TestType

    Case $eChrome
        SetupChrome()

EndSwitch

_WD_Startup()


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

$sSession = _WD_CreateSession($sDesiredCapabilities)

If @error = $_WD_ERROR_Success Then
    For $iIndex = 0 To UBound($aDemoSuite, $UBOUND_ROWS) - 1
        If $aDemoSuite[$iIndex][1] Then
            ConsoleWrite("Running: " & $aDemoSuite[$iIndex][0] & @CRLF)
            Call($aDemoSuite[$iIndex][0])
        Else
            ConsoleWrite("Bypass: " & $aDemoSuite[$iIndex][0] & @CRLF)
        EndIf
    Next
EndIf

_WD_DeleteSession($sSession)
_WD_Shutdown()


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

$sSession = _WD_CreateSession($sDesiredCapabilities)

If @error = $_WD_ERROR_Success Then
    For $iIndex = 0 To UBound($aDemoSuite, $UBOUND_ROWS) - 1
        If $aDemoSuite[$iIndex][1] Then
            ConsoleWrite("Running: " & $aDemoSuite[$iIndex][0] & @CRLF)
            Call($aDemoSuite[$iIndex][0])
        Else
            ConsoleWrite("Bypass: " & $aDemoSuite[$iIndex][0] & @CRLF)
        EndIf
    Next
EndIf


;*******************************************************************************
; DEMO Function Definitions
;*******************************************************************************
Func DemoNavigation()
    _WD_Navigate($sSession, "https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true")

    _WD_Window($sSession, "Maximize")

    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true", "URL")
    Sleep(2000)

    _WD_Window($sSession, "Minimize")
    Sleep(2000)
EndFunc

Func DemoElements()

    Local $userName = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']")
    Local $password = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']")
    Local $signIN   = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='tiv_btn']")
    Local $logOut   = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//img[@id='titlebar_hyperlink_8-lbsignout_image']")

    _WD_ElementAction($sSession, $userName, 'value', "maximo")
    _WD_ElementAction($sSession, $userName, 'text')
    Sleep(500)
    _WD_ElementAction($sSession, $password, 'value', "maxpass1")
    _WD_ElementAction($sSession, $password, 'text')
    Sleep(500)
    _WD_ElementAction($sSession, $signIN, 'click')
    Sleep(5000)
    _WD_ElementAction($sSession, $logOut, 'click')
    Sleep(3000)
    MsgBox("", "test", "did it work")

EndFunc


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

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'
EndFunc
  • Results from the Scite console output:

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
_WDStartup: OS:    WIN_10 WIN32_NT 18362 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.20
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\a\Desktop\Bots\MyBotScripts\chrome.log"
_WDStartup: Port:    ****
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"76.0.3809.132","chrome":{"chromedriverVersion":"76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024})","userDataDir":"C:\\Users\\a\\AppData\\Local\\Temp\\scoped_dir5688_660073754"},"goog:chromeOptions":{"debuggerAddress":"localhost:*****"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows nt","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"},"sessionId":"9fda7ec66c283b2f751cd9e5044d0989"}}
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"76.0.3809.132","chrome":{"chromedriverVersion":"76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024})","userDataDir":"C:\\Users\\a\\AppData\\Local\\Temp\\scoped_dir5688_660073754"},"goog:chromeOptions":{"debuggerAddress":"localhost:*****"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows nt","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"},"sessionId":"9fda7ec66c283b2f751cd9e5044d0989"}}
Bypass: DemoTimeouts
Running: DemoNavigation
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/url; $sData={"url":"https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/window/maximize; $sData=
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DB5ED4+155348]\n\tOrdinal0 [0x00DB5B16+154390]\n\tOrdinal0 [0x00D921FE+8702]\n\tOrdinal0 [0x00D92616+9750]\n\tOrdinal0 [0x00D92C00+11264]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00D9203A+8250]\n\tOrdinal0 [0x00D91D62+7522]\n\tGetHandleVerifier [0x012D915C+3925068]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
_WD_Window: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stack...
_WD_Window ==> Webdriver Exception: HTTP status = 400
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true"}...
_WD_Action: {"value":"https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true"}
URL=https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["CDwindow-620730DA3319F7B54F084CE8757BFBA0"]}...
_WD_Window: {"value":["CDwindow-620730DA3319F7B54F084CE8757BFBA0"]}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"CDwindow-620730DA3319F7B54F084CE8757BFBA0"}...
_WD_Window: {"value":"CDwindow-620730DA3319F7B54F084CE8757BFBA0"}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/window; $sData={"handle":"CDwindow-620730DA3319F7B54F084CE8757BFBA0"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true"}...
_WD_Action: {"value":"https://maximo-demo76.mro.com/maximo/webclient/login/login.jsp?welcome=true"}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/window/minimize; $sData=
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DB5ED4+155348]\n\tOrdinal0 [0x00DB5B16+154390]\n\tOrdinal0 [0x00D921FE+8702]\n\tOrdinal0 [0x00D92616+9750]\n\tOrdinal0 [0x00D92C00+11264]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00D9203A+8250]\n\tOrdinal0 [0x00D91D62+7522]\n\tGetHandleVerifier [0x012D915C+3925068]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
_WD_Window: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stack...
_WD_Window ==> Webdriver Exception: HTTP status = 400
Running: DemoElements
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element; $sData={"using":"xpath","value":"//input[@name='username']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"6f72b6ad-1524-48b1-b0d7-22018536f3c9"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"6f72b6ad-1524-48b1-b0d7-22018536f3c9"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element; $sData={"using":"xpath","value":"//input[@name='password']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"17e2eea3-a5b2-4d19-8893-ffaf73dd88a0"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"17e2eea3-a5b2-4d19-8893-ffaf73dd88a0"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element; $sData={"using":"xpath","value":"//button[@class='tiv_btn']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"0fec7351-b005-4510-8f3b-6a21d5a7d116"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0fec7351-b005-4510-8f3b-6a21d5a7d116"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element; $sData={"using":"xpath","value":"//img[@id='titlebar_hyperlink_8-lbsignout_image']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//img[@id='titlebar_hyperlink_8-lbsignout_image']\"}\n  (Session info: chrome=76.0.3809.132)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DA66C3+91843]\n\tOrdinal0 [0x00DBFB30+195376]\n\tOrdinal0 [0x00DB75C0+161216]\n\tOrdinal0 [0x00DBE7AB+190379]\n\tOrdinal0 [0x00DB742B+160811]\n\tOrdinal0 [0x00DA0AE6+68326]\n\tOrdinal0 [0x00DA1BF0+72688]\n\tOrdinal0 [0x00DA1B89+72585]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00E96A4B+1075787]\n\tOrdinal0 [0x00E96BB3+1076147]\n\tOrdinal0 [0x00E95B65+1071973]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//img[@id='titlebar_hyperlink_8-lbsignout_image']\"}\n  (Session info: chrome=76.0.3809.132)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DA66C3+91843]\n\tOrdinal0 [0x00DBFB30+195376]\n\tOrdinal0 [0x00DB75C0+161216]\n\tOrdinal0 [0x00DBE7AB+190379]\n\tOrdinal0 [0x00DB742B+160811]\n\tOrdinal0 [0x00DA0AE6+68326]\n\tOrdinal0 [0x00DA1BF0+72688]\n\tOrdinal0 [0x00DA1B89+72585]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00E96A4B+1075787]\n\tOrdinal0 [0x00E96BB3+1076147]\n\tOrdinal0 [0x00E95B65+1071973]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element/6f72b6ad-1524-48b1-b0d7-22018536f3c9/value; $sData={"id":"6f72b6ad-1524-48b1-b0d7-22018536f3c9", "text":"maximo"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element/6f72b6ad-1524-48b1-b0d7-22018536f3c9/text
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":""}...
_WD_ElementAction: {"value":""}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element/17e2eea3-a5b2-4d19-8893-ffaf73dd88a0/value; $sData={"id":"17e2eea3-a5b2-4d19-8893-ffaf73dd88a0", "text":"maxpass1"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element/17e2eea3-a5b2-4d19-8893-ffaf73dd88a0/text
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":""}...
_WD_ElementAction: {"value":""}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element/0fec7351-b005-4510-8f3b-6a21d5a7d116/click; $sData={"id":"0fec7351-b005-4510-8f3b-6a21d5a7d116"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989/element//click; $sData={"id":""}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=76.0.3809.132)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DA6000+90112]\n\tOrdinal0 [0x00DA72B6+94902]\n\tOrdinal0 [0x00DA2862+75874]\n\tOrdinal0 [0x00DB758D+161165]\n\tOrdinal0 [0x00DA2626+75302]\n\tOrdinal0 [0x00DB77A1+161697]\n\tOrdinal0 [0x00DBE7AB+190379]\n\tOrdinal0 [0x00DB742B+160811]\n\tOrdinal0 [0x00DA0AE6+68326]\n\tOrdinal0 [0x00DA1BF0+72688]\n\tOrdinal0 [0x00DA1B89+72585]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00E96A4B+1075787]\n\tOrdinal0 [0x00E96BB3+1076147]\n\tOrdinal0 [0x00E95B65+1071973]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
_WD_ElementAction: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=76.0.3809.132)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00EF7C53+1473619]\n\tOrdinal0 [0x00E7AD71+961905]\n\tOrdinal0 [0x00E042B3+475827]\n\tOrdinal0 [0x00DA6000+90112]\n\tOrdinal0 [0x00DA72B6+94902]\n\tOrdinal0 [0x00DA2862+75874]\n\tOrdinal0 [0x00DB758D+161165]\n\tOrdinal0 [0x00DA2626+75302]\n\tOrdinal0 [0x00DB77A1+161697]\n\tOrdinal0 [0x00DBE7AB+190379]\n\tOrdinal0 [0x00DB742B+160811]\n\tOrdinal0 [0x00DA0AE6+68326]\n\tOrdinal0 [0x00DA1BF0+72688]\n\tOrdinal0 [0x00DA1B89+72585]\n\tOrdinal0 [0x00E94B37+1067831]\n\tGetHandleVerifier [0x00F96845+506677]\n\tGetHandleVerifier [0x00F965E0+506064]\n\tGetHandleVerifier [0x00F9D188+533624]\n\tGetHandleVerifier [0x00F9701A+508682]\n\tOrdinal0 [0x00E8C226+1032742]\n\tOrdinal0 [0x00E8C09F+1032351]\n\tOrdinal0 [0x00E96A4B+1075787]\n\tOrdinal0 [0x00E96BB3+1076147]\n\tOrdinal0 [0x00E95B65+1071973]\n\tBaseThreadInitThunk [0x77036359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77227A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77227A64+180]\n"}}
Bypass: DemoScript
Bypass: DemoCookies
Bypass: DemoAlerts
Bypass: DemoFrames
Bypass: DemoActions
Bypass: DemoWindows
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/9fda7ec66c283b2f751cd9e5044d0989
__WD_Delete: StatusCode=200; ResponseText={"value":null}
_WD_DeleteSession: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
+>11:28:19 AutoIt3.exe ended.rc:0
+>11:28:19 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 38.29

 

 

Hopefully, that is everything you wanted please let me know if it is not. 

Edited by nooneclose
Link to post
Share on other sites
2 minutes ago, nooneclose said:

Webdriver name and version - WebDriver-0.1.0.16

Actually, I was referring to the actual webdriver console app (Geckodriver, chromedriver, etc) here. However, this brings up a valid omission from my earlier list -- the version of the WD UDF. In this case, you are using an outdated version. Please update and then retest / report back.

Quote

_WDStartup: WD.au3:    0.1.0.20

Ah... so you are using the latest version. Looks like your prior info wasn't accurate.

Like I mentioned earlier, I believe the implementation is correct per the W3C specs. Not sure why Firefox and Chrome aren't recognizing these commands.

Link to post
Share on other sites

@Danp2 Thank you for explaining it to me. Last question (hopefully :)) Since I can not get this to work in Chrome how would I go about getting the "MicrosoftWebDriver.exe" I do not see a link for it on the webpage. Does it come with windows 10? Again sorry if I am asking some really stupid/obvious questions. 

 

Link to post
Share on other sites

@Danp2 I got edge WebDriver to work. Thank you very much for your help.

my only problem now is that the logout click isn't working. I think it is due to once sign-in is clicked a new page is displayed and I have to re-attach the _wd_window or something so it knows where the logout image is located. 

Edited by nooneclose
Link to post
Share on other sites

@nooneclose This is what I use, which I believe has been recently posted on the forum --

; Edge (standard)
_WD_Option('Driver', 'MicrosoftWebDriver.exe')
_WD_Option('Port', 17556)
_WD_Option('DriverParams', '--host=127.0.0.1')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c":true, "binary":"' & StringReplace (@UserProfileDir, "\", "/") & '/AppData/Local/Microsoft/Edge SxS/Application/msedge.exe"}}}}'

 

Link to post
Share on other sites

@Danp2 sorry I was editing my post for a long time. Is this:

5 minutes ago, Danp2 said:

@nooneclose This is what I use, which I believe has been recently posted on the forum --

; Edge (standard)
_WD_Option('Driver', 'MicrosoftWebDriver.exe')
_WD_Option('Port', 17556)
_WD_Option('DriverParams', '--host=127.0.0.1')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c":true, "binary":"' & StringReplace (@UserProfileDir, "\", "/") & '/AppData/Local/Microsoft/Edge SxS/Application/msedge.exe"}}}}'

 

 to make edge work or is this for refreshing the Window when a new page is displayed? Again sorry it took me so long to edit my post I was running tests to see if I could get EdgeWebDriver to work. (turned out I had a const always choosing chrome and that's why it wasn't working XD)

Edited by nooneclose
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 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
       

    • By TTE26
      For the past two days I've been reading all Wiki pages, installed all the demos etc. but I am still unable to do this simple workflow
      1. I want to use WebDriver UDF to open Chrome (Set chrome option arguments - Window Size, Pixel ratio, device type and platform name, user-agent.)
      2. On new Tab I want to read the tab Title and save it into a TXT file.
      3. I need to save the Session ID with my previosly set Capabilities into a file.
      4. I want to close the chrome window.
      Then
      5. I want to open Chrome again, but with my previosly saved Session ID and Capabilities list from the file.
      6. And minimaze the window state.
      7. After 30 seconds, close the chrome.
      I would really appreciate for the WebDriver UDF Helper file, to have also basic code examples, for non coders. For example how to open a windwow etc., save sessions, etc.
      Anyway, if someone could help me get started and help me with this workflow, that would be much appreaciated. 😔
    • By lapoelkan12
      hi i try to use webdriver  i download it and  download json and  winhttp i try to run it  but  return error
       error: __WinHttpVer(): undefined function.
              Local $sWinHttpVer = __WinHttpVer()
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
       
       

    • By levila
      Hi Guys, i just do some codding to automate login to some of the web.
      I manage to do the script but somehow after script done, some weird box popup. and keep looping until i close the main chrome.exe

      here is my code. kinldy pls assist, im very new to webdriver udf.
      #NoTrayIcon #include "wd_core.au3" #include "wd_helper.au3" $_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://someoftheweb.com") _ChromeSetInputValueByName($sSession, "inputName", "Username") _ChromeSetInputValueById($sSession, "inputPassword", "Password") _ChromeSetMouseClick($sSession, "submit", "click") _WD_Shutdown() Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--no-sandbox"]}}}}' EndFunc Func _ChromeSetInputValueByName($sSession,$name,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$name&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Func _ChromeSetInputValueById($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Func _ChromeSetMouseClick($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//button[@type='"&$Id&"']") _WD_ElementAction($sSession, $sButton, 'click', $Value) EndFunc  
    • By RohanM
      Hi Team,
      is there is a way to embed the webpage in auto it GUI using webdriver? what I want to do is that, I want to open edge browser inside the AutoIT GUI, in IE we have _IECreateEmbedded function but for the webdriver I am not able to find a function, please help  
      Rohan M
×
×
  • Create New...