Jump to content

WebDriver UDF - Help & Support (II)


Danp2
 Share

Recommended Posts

I'm sorry like always I'm not fast to understand.

I tried that :

ToolTip ( "Exist seek new incident" , 1 , 1 )
WinActivate("Google")
Send("^q")
Sleep(1500)
Local $sFrame = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//frame[@id='main']")
ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
_WD_FrameEnter($sSession, $sFrame)
ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[contains(@id,'fraIdentification_icb_I_CAUORPER_ORIG_t')]")
_WD_ElementOptionSelect ($sSession, $_WD_LOCATOR_ByXPath, 'Mail' , $sElement )

Output :

_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_10 WIN32_NT 17763 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.4.0.1 (Up to date)
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: 
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0.4324.146","chrome":{"chromedriverVersion":"88.0.4324.27 (6347fe8bf1e48bd0c54d07dc55ca011cf40861c9-refs/branch-heads/4324@{#450})","userDataDir":"C:\\Users\\XXXXXX\\AppData\\Local\\Temp\\scoped_dir22848_666692230"},"goog:chromeOptions":{"debuggerAddress":"localhost:49840"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"7d412495e7cb1e8ad22940be044ebfc7"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/window/maximize; $sData={}
__WD_Post: StatusCode=200; ResponseText={"value":{"height":1056,"width":1936,"x":-8,"y":-8}}...
_WD_Window: {"value":{"height":1056,"width":1936,"x":-8,"y":-8}}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/url; $sData={"url":"https://XXXXXXXXXX/HOMEPAGE.aspx"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/element; $sData={"using":"xpath","value":"//frame[@id='main']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"94d6f483-ce7f-4cd6-8918-4cc1b79fc5db"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"94d6f483-ce7f-4cd6-8918-4cc1b79fc5db"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/execute/sync; $sData={"script":"return window.frames.length", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":4}...
_WD_ExecuteScript: {"value":4}...
Frames=4
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/execute/sync; $sData={"script":"return window.top == window.self", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":true}...
_WD_ExecuteScript: {"value":true}...
TopWindow=True
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/frame; $sData={"id":{"element-6066-11e4-a52e-4f735466cecf":"94d6f483-ce7f-4cd6-8918-4cc1b79fc5db"}}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/execute/sync; $sData={"script":"return window.top == window.self", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":false}...
_WD_ExecuteScript: {"value":false}...
TopWindow=False
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/element; $sData={"using":"xpath","value":"//input[contains(@id,'fraIdentification_icb_I_CAUORPER_ORIG_t')]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"11912157-d9b0-4abd-8078-94c0ef75abba"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"11912157-d9b0-4abd-8078-94c0ef75abba"}}
_WD_FindElement: Selector must be relative when supplying a starting element
_WD_FindElement ==> Invalid Expression: HTTP status = 200
__WD_Post: URL=HTTP://127.0.0.1:9515/session/7d412495e7cb1e8ad22940be044ebfc7/frame/parent; $sData={}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...

oh btw ^q is to open special script on the webpage I need to act on this page. It's the same way you shordcut new mail in outlook.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen You aren't passing the correct parameters to _WD_ElementOptionSelect. The xpath needs to be for the desired option within the select element. If you look at the coding for _WD_ElementOptionSelect, you will see that it calls _WD_FindElement and then automatically clicks the element if found.

You can remove your call to _WD_FindElement since that's handled for you, but you need to use the correct xpath.

P.S. There are ways to send keystrokes to the browser using the Webdriver UDF, so you shouldn't need to use Send() at all

Link to comment
Share on other sites

Yeah While I was searching for this issue I see about WD keystroke I will do that after I'm strugling on my first issue first x).

So ok I understand now how _WD_ElementOptionSelect work a bit better not sure it's related to my issue now because I'm not like other users. I don't have somthing like a select with multiples values.

The element is selected I guess becose It open the list. But I never succed to select any item of the menu exept sending keys. But I'm sure I could do more reliable and faster and better.

This is my xpath :

<input name="fraIdentification$icb_I_CAUORPER_ORIG$t" type="text" readonly="readonly" id="fraIdentification_icb_I_CAUORPER_ORIG_t" tabindex="2" class="tcTb iCompulsory iCtrlEna" onfocus="iCtFs('fraIdentification_icb_I_CAUORPER_ORIG_t', 'fraIdentification_icb_I_CAUORPER_ORIG_t');" autocomplete="off" onblur="iHSugg(event);iCtc(false, event);" onchange="iChkFt('fraIdentification_icb_I_CAUORPER_ORIG_t','',-1,0);if(!sgtCFE(this)) return; if (iACnxChg('icb_I_CAUORPER_ORIG','fraIdentification_icb_I_CAUORPER_ORIG_t','fraIdentification_icb_I_CAUORPER_ORIG_hv', event)) return; iCState(); " onkeydown="iCtc(true, event);ic_sugg_kd(event);" isititle="###" onkeyup="iSuggEvt(false,4,'icb_I_CAUORPER_ORIG', event);; " irst="True" onmousedown="ic_md('fraIdentification_icb_I_CAUORPER_ORIG_t', '../../',event);" style="width:153px;z-index:75;float:left;" isifireevent="false">

This website is special there is frames... There is script everywhere... even the dropdown menu is scripted. I can see that.
image.thumb.png.746d9278c9ad21d116d75f7d3aecd7f9.png

 

Oh While I put the windows big for you to make good screenshot :

If I choose an other valut from that list it change the value here :

<input name="fraIdentification$icb_I_CAUORPER_ORIG$hv" type="hidden" id="fraIdentification_icb_I_CAUORPER_ORIG_hv" irst="True" value="Mail">

Never noticed that before. But If I change value manually it does affect the field.

 

What is the methode to have the code of disapearing items while right clicking ?

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Oh I just noticed something... When you click. There is something like a loading animation on all fields. I'll try to capture it.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen From your description, it sounds like the website uses a framework such as Angular, React, etc. These are generally more difficult to automate because of the obfuscation (ie: hidden elements tracking data). Try to figure out the framework involved. Once you have that, you will need to research how to programmatically control this framework.

Link to comment
Share on other sites

; Close the current tab
_WD_Window($sSession, "Close")

I found that studying the wd_demo.au3 is one easy way to learn the basic "how-to".  Then there is the Wiki that can also help on specific FAQ.  Google and forum search tools to look for specific issue should complete the process of learning.

Of course, opening the wd_core.au3 and wd_helper.au3 files to get a full description of the functions.

And then, try, test, learn, try, test, learn, ......

At the very end, you can ask question here ;)

Link to comment
Share on other sites

@Danp2 Hello mate,       //// @tr57 I'm also trying to send keystroke so you could maybe follow this... But I'm not sure :D let's see danp2 answers.

I did what you said. 

Not about the framework of the website I mean on the keysend thing. I thought that was gonna be easy lol... But from what I can see... Selenium doc is telling : send key with selenium is depreciated. There is a private API that you provided to @Hamburgo that do the work. And this is the depreciated thing. 

So... here is my question... From your side... What is the best way to do it ? 

ControlSend ?

The syntax of selenium that I don't know yet ? 

Send ? < - already answered about send that you dislike. So.... I'm lost into that. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

44 minutes ago, caramen said:

There is a private API that you provided to @Hamburgo that do the work. And this is the depreciated thing. 

No idea what you're talking about here. Can you provide a link?

Not sure why you are referencing Selenium. AFAIK, it is a wrapper around the webdriver calls much like this UDF.

P.S. I know that this issue has already been addressed on the forum

Link to comment
Share on other sites

Oh mistake.. not API but module I mean. You provided to @Hamburgo this : https://github.com/nicholaswmin/webdriver-actions

And after searching. I found the keylist of this snippet. https://www.selenium.dev/selenium/docs/api/rb/Selenium/WebDriver/Keys.html

After all that, for me, the best way to send "^c" is to use controlsend at the moment until someone show me better...

 

Could you give us a hint on how to complete this in autoit with your udf please ?

element.send_keys [:control, 'a'], :space

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

14 minutes ago, Danp2 said:

@caramen Like I said before, this topic has been already covered. Have you tried searching this thread for the terms keydown or keyup? 😉

Oh man sry I missed that ! :) thx I'll search right now.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Hello @Danp2

Just a little question about that please :

image.png.def10ce317775f7679e406897ae17689.png

 

I know that most of time when we run google chrome we have multiple process sometime because of tabs or what ever.

Anyway... I would like to be sure that I have only one instance of chrome  started by chromedriver even if my script start 3 of them. How can I be sure of this please ?

When I dev and then I stop my script running... After trying that 30 time I have sometime 30 instance of chrome running. Is there a good hint for me to dodge that adding some code ?

 

Ops Nvm.

I was missing  "_WD_DeleteSession ( $sSession )" In my exit function.

Solved sorry.
 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I'm trying to send "^n" to Chrome like this, but doesn't work: 

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

 

 
Edited by frank10
Link to comment
Share on other sites

I want to open a new window on Chrome browser, so I already tried the

_WD_Window($sSession, "new")

but it does nothing.

It opens a new window if the chrome browser was already opened... but this way I cannot attach to its session and cannot communicate with WD.

Link to comment
Share on other sites

@frank10 Posting a line or two of code and then stating it doesn't work won't get you the help you likely desire. Suggest that you post a short "reproducer" script that we can run to get a better understanding of what you want to accomplish. You can also post the results from the Scite output panel so that we can see which commands are returning errors.

You may want to check out the FAQ section in the Webdriver wiki entry.

Link to comment
Share on other sites

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

Opt("WinTitleMatchMode", 2)
OnAutoItExitRegister("_onExit")

$_WD_DEBUG =  True ; You could also use $_WD_DEBUG_Error
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)

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

_WD_Startup()

global $sSession = _WD_CreateSession($sChrome)

_WD_Window($sSession, "new")

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

while 1 
    Sleep(100)
wend

Func _onExit()
    _WD_DeleteSession($sSession)
    _WD_Shutdown()
EndFunc

It's really the most simple code with only one command _WD_window

Console:

+>19:47:40 Starting AutoIt3Wrapper (19.1127.1402.0} from:Code.exe (1.53.2.0)  Keyboard:00000410  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0410)
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:c:\___SP\____AMAZON_Kindle_SelfPublishing\PROG_analisiKW\Untitled-2____WD.au3
+>19:47:41 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "c:\___SP\____AMAZON_Kindle_SelfPublishing\PROG_analisiKW\Untitled-2____WD.au3"  /errorstdout
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
_WD_IsLatestRelease: False
_WDStartup: OS: WIN_10 WIN32_NT 18363 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.3.0.8 (Update available)
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: 
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[" --user-data-dir=C:\\Users\\fsemi\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0.4324.182","chrome":{"chromedriverVersion":"88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784})","userDataDir":"C:\\Users\\fsemi\\AppData\\Local\\Google\\Chrome\\User Data\\"},"goog:chromeOptions":{"debuggerAddress":"localhost:50731"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"cdf39a8e0b78ba5de456b128339439f4"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/cdf39a8e0b78ba5de456b128339439f4/title
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":""}...
_WD_Action: {"value":""}
0x048E0BC4hChrome:0_ext:0
__WD_Post: URL=HTTP://127.0.0.1:9515/session/cdf39a8e0b78ba5de456b128339439f4/window/new; $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\tGetHandleVerifier [0x0039B963+483]\n\tGetHandleVerifier [0x0039B941+449]\n\tGetHandleVerifier [0x00743308+3832712]\n\tGetHandleVerifier [0x007793CB+4054091]\n\tGetHandleVerifier [0x00778EC5+4052805]\n\tGetHandleVerifier [0x0072A784+3731460]\n\tGetHandleVerifier [0x0072AC76+3732726]\n\tGetHandleVerifier [0x0072AF41+3733441]\n\tOrdinal0 [0x0035B5CC+46540]\n\tOrdinal0 [0x00359F53+40787]\n\tOrdinal0 [0x00359B12+39698]\n\tGetHandleVerifier [0x00661468+2907368]\n\tGetHandleVerifier [0x004A71EE+1096302]\n\tGetHandleVerifier [0x00463E8D+821005]\n\tGetHandleVerifier [0x0072A4FB+3730811]\n\tGetHandleVerifier [0x00729F2C+3729324]\n\tGetHandleVerifier [0x00A00F2C+6707116]\n\tBaseThreadInitThunk [0x76E56359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77228944+228]\n\tRtlGetAppContainerNamedObjectPath [0x77228914+180]\n"}}
_WD_Window: {"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stack...
_WD_Window ==> Invalid argument: HTTP status = 400
__WD_Delete: URL=HTTP://127.0.0.1:9515/session/cdf39a8e0b78ba5de456b128339439f4
__WD_Delete: StatusCode=200; ResponseText={"value":null}...
_WD_DeleteSession: {"value":null}
 closeDriver_WD_shutdown:chromedriver.exe 11344
+>19:47:49 AutoIt3.exe ended.rc:0
+>19:47:49 AutoIt3Wrapper Finished.
Process exited with code 0

Instead of the _WD_Window, if I use the other 2 rows with the actions to Send Keys, it does nothing, even if it seems to send them, this is the console:

__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[" --user-data-dir=C:\\Users\\fsemi\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0....
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"88.0.4324.182","chrome":{"chromedriverVersion":"88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784})","userDataDir":"C:\\Users\\fsemi\\AppData\\Local\\Google\\Chrome\\User Data\\"},"goog:chromeOptions":{"debuggerAddress":"localhost:50777"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"5ecb2945856eec9dafa9fd2e01904791"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5ecb2945856eec9dafa9fd2e01904791/actions; $sData={"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE009"}, {"type": "keyDown", "value": "\u0066"},{"type": "keyUp", "value": "\u0066"}, {"type": "keyUp", "valu
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Action: {"value":null}

 

Link to comment
Share on other sites

42 minutes ago, frank10 said:

_WDStartup: WD.au3: 0.3.0.8 (Update available)

You are several releases behind. Please update to the latest release on Github

55 minutes ago, frank10 said:

_WD_Window($sSession, "new")

You'll need to supply the appropriate value for the $sOption parameter or you can just use the function _WD_NewTab instead.

Link to comment
Share on other sites

12 minutes ago, Danp2 said:

You'll need to supply the appropriate value for the $sOption parameter or you can just use the function _WD_NewTab instead.

I'm sorry, I already had updated it, I was pointing to an older file in the wrong dir in the include...

 

I don't want to open a new tab inside the chrome window. I want to open a new chrome window, the same you can obtain pressing Ctrl+n on the keyboard.

In the UDF func there is :

$sOption   - [optional] a string value. Default is ''.

So I thought it was not necessary. Anyway what is the appropriate value for $sOption to open a new window?

EDIT

Or do I misunderstanded it? I thought WD_NewTab opens a new tab and _WD_window with "new" opens a new window...

 

Anyway I need a new window, not a new tab. If _WD_Window is not the right command, I tried also to send keys  "^n" with

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

as in the script before. Please help also with that not working.

Edited by frank10
Link to comment
Share on other sites

@frank10 $sOption is optional as far as the function is concerned. However, it is required for some of the $sCommand actions, like "New". If you look at the code for WD_NewTab, you'll find that it calls _WD_Window like this to create a new tab --

$sTabHandle = _WD_Window($sSession, 'new', '{"type":"tab"}')

Now check out the New Window W3C specs to see that you can also pass a type of "window". Thus you should be able to get the desired result with this --

$sTabHandle = _WD_Window($sSession, 'new', '{"type":"window"}')

 

Link to comment
Share on other sites

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