Search the Community
Showing results for tags 'webdriver udf'.
-
Running AutoIt v3.3.16.1. au3WebDriver v1.3.1 downloaded from https://github.com/Danp2/au3WebDriver about a week or two ago. Before posting this question, I went back there and noticed that three files have been updated (wd_core.au3, wd_demo.au3, wd_helper.au3). I have updated those three files, but the problem persists. Using Firefox with geckodriver. I am trying to click on a search button on a specific web page. By default, this forces a new window to open with the content. However, I want the content to open in a new tab, not in a new window. If I hold down CONTROL key and then mouse click on the button, then it opens in a tab. So I am trying to reproduce this in au3WebDriver code with _WD_ElementActionEx() using command "MODIFIERCLICK". I tried a number of different things but I kept getting Invalid argument. Here is an example: _WD_ElementActionEx($sSession, $sElement_btnAssetLookup, "modifierclick", Default, Default, Default, Default, "\ue009") And here is the error message: _WD_ElementActionEx ==> Invalid argument [5] : Parameters: Element=ab689017-29ea-4441-943e-621e3bb7d7e5 Command=modifierclick XOffset=Default YOffset=Default Button=Default HoldDelay=Default Modifier=\ue009 ScrollView=Default For awhile I was not sure if I was specifying the WebDriver key for CONTROL correctly. So then I went back and decided to use command "click" just to make sure I had everything else specified correctly. And that opens a new window as expected without errors. _WD_ElementActionEx($sSession, $sElement_btnAssetLookup, "click", Default, Default, Default, Default, Default) _WD_ElementActionEx ==> Success [0] : Parameters: Element=ce6b46bf-431c-4de9-8602-f199a27881f1 Command=click XOffset=Default YOffset=Default Button=Default HoldDelay=Default Modifier=Default ScrollView=Default I started thinking maybe you just cannot send CONTROL to the button using command "modifierclick". So then I went and tried to use _WD_ElementActionEx() with command "modifierclick" using only defaults (according to the UDF, Default for $sModifier is "\uE008" (shift key). SHIFT is not what I wanted, but I wanted to verify it would at least complete without an error, but it did not. Here is what I tried: _WD_ElementActionEx($sSession, $sElement_btnAssetLookup, "modifierclick", Default, Default, Default, Default, Default) That gives a similar error message. _WD_ElementActionEx ==> Invalid argument [5] : Parameters: Element=9913ac04-2eed-4f20-871e-17efb09ca417 Command=modifierclick XOffset=Default YOffset=Default Button=Default HoldDelay=Default Modifier=Default ScrollView=Default Anyone have any idea what is going on? Thanks.
-
In the old FF.au3 library, there were two functions for getting and setting values of about:config preferences for Firefox. I was wondering if there are any equivalents for WebDriver au3, @Danp2 Func _FFPrefGet($sName) Local Const $sFuncName = "_FFPrefGet" Local $sCommand Local $iType = _FFCmd('FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("' & $sName & '");') If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, $sName)) Return 0 EndIf Switch $iType Case 0 SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sName: " & $sName)) Return 0 Case 32 ; PREF_STRING $sCommand = "getCharPref" Case 64 ; PREF_INT $sCommand = "getIntPref" Case 128 ; PREF_BOOL $sCommand = "getBoolPref" EndSwitch $sCommand = StringFormat('FFau3.obj.%s("%s");', $sCommand, $sName) Return _FFCmd($sCommand) EndFunc ;==>_FFPrefGet Func _FFPrefSet($sName, $vValue) Local Const $sFuncName = "_FFPrefSet" Local $sCommand Local $iType = _FFCmd('FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("' & $sName & '");') If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, $sName)) Return 0 EndIf Local $vOldValue = _FFPrefGet($sName) Switch $iType Case 0 SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sName: " & $sName)) Return 0 Case 32 ; PREF_STRING If Not IsString($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(string) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s","%s");', "setCharPref", $sName, $vValue) Case 64 ; PREF_INT If Not IsInt($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s",%s);', "setIntPref", $sName, $vValue) Case 128 ; PREF_BOOL If Not IsBool($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(bool) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s",%s);', "setBoolPref", $sName, __FFB2S($vValue)) EndSwitch _FFCmd($sCommand) If Not @error Then Local $vRetVal = _FFPrefGet($sName) If Not @error And $vRetVal = $vValue Then SetExtended($vOldValue) Return 1 Else SetError(__FFError($sFuncName, $_FF_ERROR_RetValue, "$vValue <> " & $vRetVal)) Return 0 EndIf EndIf Return 0 EndFunc ;==>_FFPrefSet
- 1 reply
-
- webdriver
- webdriver udf
-
(and 1 more)
Tagged with:
-
Hi, With Internet Explorer, if I wanted to restore windows, I used : Local $hWnd = _IEPropertyGet($oIE, 'hwnd') WinSetState($hWnd, '', @SW_RESTORE) Is it possible to do same thing with _WD fonction ?