Jump to content

WebDriver UDF - Help & Support


Recommended Posts

If i close the tab, this error occurs again.

 

_WD_NewTab ==> Webdriver Exception
__WD_Post: URL=HTTP://127.0.0.1:4444/session/e5a7d146-e5f7-484a-921c-62dd1ca32f26/url; $sData={"url":"https://duckduckgo.com/?q=0&t=ffab&iar=images&iax=images&ia=images"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178:5\nNoSuchWindowError@chrome://marionette/content/error.js:410:5\nassert.that/<@chrome://marionette/content/assert.js:401:13\nassert.open@chrome://marionette/content/assert.js:157:10\nGeckoDriver.prototype.get@chrome://marionette/content/driver.js:1060:3\ndespatch@chrome://marionette/content/server.js:291:20\nexecute@chrome://marionette/content/server.js:264:11\nonPacket/<@chrome://marionette/content/server.js:237:15\nonPacket@chrome://marionette/content/server.js:236:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n"}}
_WD_Navigate: {"value":{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178:5\nNoSuchWindowError@chrome://marionette/content/error.js:410:5\nassert.that/<@chrome://marionette/content/assert.js:401:13\nassert.open@chrome://marionette/content/assert.js:157:10\nGeckoDriver.prototype.get@chrome://marionette/content/driver.js:1060:3\ndespatch@chrome://marionette/content/server.js:291:20\nexecute@chrome://marionette/content/server.js:264:11\nonPacket/<@chrome://marionette/content/server.js:237:15\nonPacket@chrome://marionette/content/server.js:236:8\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:490:9\n"}}

 

Edited by horphi
Link to comment
Share on other sites

5 hours ago, horphi said:

_WD_NewTab ==> Webdriver Exception

It would be helpful to see the related output just prior to this.

I'll need to do some more testing, but it's possible that it works for me because I tested with my latest development source.

Edit: The new version depends on a change to _WD_Window.

Edited by Danp2
Link to comment
Share on other sites

I have the following html Code:
 

<div class="custom-dropdown">
                                                    <i class="iconfont iconfont-ls_icon_arrow_small" data-ember-action="1530" style="touch-action: manipulation; -ms-touch-action: manipulation"></i>
                                                    <span class="label-text" data-ember-action="1531" onclick="showMenu()" style="touch-action: manipulation; -ms-touch-action: manipulation">Grund auswählen</span>
                                                        <div class="dropdown-menu" data-ember-action="1532" style="touch-action: manipulation; -ms-touch-action: manipulation">
                                                            <ul class="option-list" id="ddMenu" style="display: none;"><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich benutze den Service nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Der Preis ist zu teuer</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich mag den Stil der Kommentatoren nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich wechsel zur Konkurrenz</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Zu viel Buffering, oder Verzögerung im Livestream</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich mag das Layout der App nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Schlechte Bild-, oder Tonqualität</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Das Gerät mit dem ich streamen möchte wird nicht unterstützt</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Meine Sportart, oder das Turnier ist nicht verfügbar</div></li></ul>
                                                        </div>
                                                    <input>
                                                    <span class="error-message">Bitte wähle den Grund für deine Kündigung aus</span>
                                                </div>

This is a dropdown Menu and i want to click on the first dropdown Option,
im using following xpath: "//*[@id='ddMenu']/li[1]"
And when i click on it i get the following error:
"error":"stale element reference","message":"element is not attached to the page document"

 

My Code:
 

; DropDown Menu
   _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='label-text']", $myDelay, $myTimeout, True)
   $dropdownMenu = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='label-text']")
   _WD_ElementAction($sSession, $dropdownMenu, 'click')

   ; options
   $option = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='ddMenu']/li[1]", Default, True)
   _WD_ElementAction($sSession, $option, 'click')

 

First I open the dropdown Menu which works, but selecting an option doesnt work, any idea?

Edited by Lunier
Typo
Link to comment
Share on other sites

9 minutes ago, Lunier said:

I have the following html Code:
 

<div class="custom-dropdown">
                                                    <i class="iconfont iconfont-ls_icon_arrow_small" data-ember-action="1530" style="touch-action: manipulation; -ms-touch-action: manipulation"></i>
                                                    <span class="label-text" data-ember-action="1531" onclick="showMenu()" style="touch-action: manipulation; -ms-touch-action: manipulation">Grund auswählen</span>
                                                        <div class="dropdown-menu" data-ember-action="1532" style="touch-action: manipulation; -ms-touch-action: manipulation">
                                                            <ul class="option-list" id="ddMenu" style="display: none;"><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich benutze den Service nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Der Preis ist zu teuer</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich mag den Stil der Kommentatoren nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich wechsel zur Konkurrenz</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Zu viel Buffering, oder Verzögerung im Livestream</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Ich mag das Layout der App nicht</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Schlechte Bild-, oder Tonqualität</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Das Gerät mit dem ich streamen möchte wird nicht unterstützt</div></li><li class="dropdown-option" data-ember-action="1538" onclick="showTechHelpDiv()" style="touch-action: manipulation; -ms-touch-action: manipulation"><div>Meine Sportart, oder das Turnier ist nicht verfügbar</div></li></ul>
                                                        </div>
                                                    <input>
                                                    <span class="error-message">Bitte wähle den Grund für deine Kündigung aus</span>
                                                </div>

This is a dropdown Menu and i want to click on the first dropdown Option,
im using following xpath: "//*[@id='ddMenu']/li[1]"
And when i click on it i get the following error:
"error":"stale element reference","message":"element is not attached to the page document"

 

My Code:
 

; DropDown Menu
   _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='label-text']", $myDelay, $myTimeout, True)
   $dropdownMenu = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='label-text']")
   _WD_ElementAction($sSession, $dropdownMenu, 'click')

   ; options
   $option = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='ddMenu']/li[1]", Default, True)
   _WD_ElementAction($sSession, $option, 'click')

 

First I open the dropdown Menu which works, but selecting an option doesnt work, any idea?

Forgot to remove the last 2 parameters of 

 $option = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='ddMenu']/li[1]", Default, True)

So if i use the following line:
 

$option = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='ddMenu']/li[1]")

It works now.

My bad. :)

Link to comment
Share on other sites

I am looking to run chromedriver using a persistent chrome profile. I am having an issue getting my argument to pass to chromedriver I believe, because chromedriver continues to create a temp profile each session. The console reads that I have added the --user-data-dir, and I have used the following to make sure it is correct, but am having no luck yet.

On 6/20/2018 at 11:26 AM, Decibel said:

Interesting find. I use this arg to use my own profile on my W7-64 PC:

"--user-data-dir=C:/Users/' & @UserName & '/AppData/Local/Google/Chrome/User Data"

 

I am new to using Webdriver so as a starting point I am running a copy of wd_demo with only the DriverParams of SetupGoogle() changed.

Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--user-data-dir="C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data"')

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

It seems that my params are being ignored, as the console writes that the profile being used is still the temp one

_WDStartup: OS: WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt: 3.3.14.2
_WDStartup: WD.au3: 0.1.0.17
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --user-data-dir="C:\Users\Jan\AppData\Local\Google\Chrome\User Data"
_WDStartup: Port:   9515
__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":"71.0.3578.98","chrome":{"chromedriverVersion":"2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387)","userDataDir":"C:\\Users\\Jan\\AppData\\Local\\Temp\\scoped_dir11284_12516"},"goog:chromeOptions":{"debuggerAddress":"localhost:50445"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows nt","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"},"sessionId":"ddca43a6ca34b812eab6e73a18a9d83f"}}

My apologies if this is something simple.

Thank you for your time. 

 

Edit:

Accomplished this with

 

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}'

 

Edited by Refus
Stupidity
Link to comment
Share on other sites

  • 2 weeks later...

I am new to using this WebDriver UDF and trying to figure out how to get text from a webpage. Following the demo, I can start the session and navigate to the page. The webpage html looks as follows:

<h2 class="h2classname">
    <div class="classname1">
        <span>Your points balance</span>
    </div>
    <div class="classname2">
        <span>200</span>
    </div>
</h2>

I am trying to grab the value 200. I have tried several different ways, all of which fail...

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='classname2'/span]")
$sPoints = _WD_ElementAction($sSession, $sElement, 'text')
ConsoleWrite(@CRLF & "Points: " & $sPoints & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='classname2'/span]")
$sPoints = _WD_ElementAction($sSession, $sElement, 'value')
ConsoleWrite(@CRLF & "Points: " & $sPoints & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='classname2'/span]")
$sPoints = _WD_ElementAction($sSession, $sElement, 'property', 'text')
ConsoleWrite(@CRLF & "Points: " & $sPoints & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='classname2'/span]")
$sPoints = _WD_ElementAction($sSession, $sElement, 'property', 'value')
ConsoleWrite(@CRLF & "Points: " & $sPoints & @CRLF)

Please help me understand where I am going wrong!

Edited by oxnume
Link to comment
Share on other sites

 

I am not able to see the steps of the webdriver graphically I am testing with this code:

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

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

Func DemoNavigation()
    Global $sSession
    _WD_Navigate($sSession, "http://google.com")
    _WD_NewTab($sSession)
    _WD_Navigate($sSession, "http://yahoo.com")
    _WD_NewTab($sSession)
    _WD_Navigate($sSession, "http://bing.com")

    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "google.com", "URL")
    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "yahoo.com", "URL")
    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
EndFunc

SetupChrome()

DemoNavigation()


He's returning this to me:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Digão\Desktop\Autoit\WebDriver-0.1.0.17\SetupChrome.au3" /UserParams    
+>23:31:02 Starting AutoIt3Wrapper v.18.708.1148.0 SciTE v.4.1.0.0   Keyboard:00000416  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0416)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Digão\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Digão\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Digão\Desktop\Autoit\WebDriver-0.1.0.17\SetupChrome.au3
+>23:31:02 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Digão\Desktop\Autoit\WebDriver-0.1.0.17\SetupChrome.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"http://google.com"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Navigate: 0
_WD_Navigate ==> Webdriver Exception: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window/handles
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Window: 0...
_WD_Window ==> Webdriver Exception: HTTP status = 0
_WD_NewTab ==> Webdriver Exception
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"http://yahoo.com"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Navigate: 0
_WD_Navigate ==> Webdriver Exception: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window/handles
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Window: 0...
_WD_Window ==> Webdriver Exception: HTTP status = 0
_WD_NewTab ==> Webdriver Exception
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"http://bing.com"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Navigate: 0
_WD_Navigate ==> Webdriver Exception: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:9515/session//url
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Action: 0
_WD_Action ==> Webdriver Exception: HTTP status = 0
URL=
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Window: 0...
_WD_Window ==> Webdriver Exception: HTTP status = 0
_WD_Attach ==> General Error
__WD_Get: URL=HTTP://127.0.0.1:9515/session//url
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Action: 0
_WD_Action ==> Webdriver Exception: HTTP status = 0
URL=
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Window: 0...
_WD_Window ==> Webdriver Exception: HTTP status = 0
_WD_Attach ==> General Error
__WD_Get: URL=HTTP://127.0.0.1:9515/session//url
__WD_Get: StatusCode=0; $iResult = 5; $sResponseText=0...
__WD_Get ==> Send / Recv error
_WD_Action: 0
_WD_Action ==> Webdriver Exception: HTTP status = 0
URL=
+>23:31:12 AutoIt3.exe ended.rc:0
+>23:31:12 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 11.31


How do I make a webdriver query graphically?

image.thumb.png.4e476c46bd723066a0fa5fc6fc262c12.png

Link to comment
Share on other sites

2 hours ago, rlvitorino said:

__WD_Post: URL=HTTP://127.0.0.1:9515/session//url;
$sData={"url":"http://google.com"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Navigate: 0 _
WD_Navigate ==> Webdriver Exception: HTTP status = 0

Notice the double slash between "session" and "url"? That's because the session id is missing. You're missing the following line  --

$sSession = _WD_CreateSession($sDesiredCapabilities)

 

Link to comment
Share on other sites

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

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

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":[' & """start-maximized""," & " ""disable-infobars""" & "" & '] }}}}'
EndFunc   ;==>SetupChrome

Func _ChromeSetInputValueById($sSession,$Id,$Value)
 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
 _WD_ElementAction($sSession,$sButton,'value', $Value)
EndFunc

Local $sDesiredCapabilities, $sSession
SetupChrome()

_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Navigate($sSession, "https://www.facebook.com")
_WD_Window($sSession, "maximize", "")

_ChromeSetInputValueById($sSession,'email','myemail@gmail.com')
_ChromeSetInputValueById($sSession,'pass','myemail#')

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='u_0_2']")
_WD_ElementAction($sSession, $sElement, "click")

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='u_0_c']/a", 10000, -1, False)

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='u_a_2']/input[2]")
_WD_ElementAction($sSession, $sElement, "value", "Teste Do Robô 1")

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='js_gc']")
_WD_ElementAction($sSession, $sElement, "value", "Teste Do Robô")

Sleep(3000)

_WD_Shutdown()

 

1 - I'm trying to run the script above, but generated a doubt, what options I can insert into each command ??

2 - How to run chrome normally without test mode? 

3 - How do I stop this message?

image.png.49642fbf237285784af9b0a20dfc1ee5.png

4 - How do I wait for the screen to load after typing?

 

Link to comment
Share on other sites

55 minutes ago, rlvitorino said:

1 - I'm trying to run the script above, but generated a doubt, what options I can insert into each command ??

Not sure what you mean here. If you have a specific question, just ask. Otherwise, the complete W3C specs can be viewed here.

Quote

2 - How to run chrome normally without test mode? 

Please explain what you mean by "test mode".

Quote

3 - How do I stop this message?

Have you tried adding the "disable-notifications" argument? A quick web search should give you the details needed.

Quote

4 - How do I wait for the screen to load after typing?

Please explain further.

Link to comment
Share on other sites

 

I want to do a search in google, I am assigning value by the XPATH of INPUT, asking to click through the XPATH of the button, but not executing any command. Why?

 

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

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

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":[' & """start-maximized"",""disable-notifications""," & " ""disable-infobars""" & "" & '] }}}}'
EndFunc   ;==>SetupChrome

Local $sDesiredCapabilities, $sSession
SetupChrome()

_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Navigate($sSession, "https://www.google.com")
_WD_Window($sSession, "maximize", "")

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="tsf"]/div[2]/div/div[1]/div/div[1]/input', 100, -1, False)

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="tsf"]/div[2]/div/div[1]/div/div[1]/input')
_WD_ElementAction($sSession, $sElement, "value", "Teste Autoit")

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="tsf"]/div[2]/div/div[3]/center/input[1]')
_WD_ElementAction($sSession, $sElement, "click")

Sleep(3000)

_WD_Shutdown()

 

Link to comment
Share on other sites

26 minutes ago, rlvitorino said:

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":[' & """start-maximized"",""disable-notifications""," & " ""disable-infobars""" & "" & '] }}}}'

You need to change "chromeOptions" to "goog:chromeOptions" when using the latest Chromedriver.

Other than that, you should check your xpath for proper format/structure. Also, check out the function DemoElements in wd_demo.au3 for an example of running a search in Google.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...