Danp2 Posted November 26, 2019 Author Posted November 26, 2019 8 minutes ago, loulou2522 said: Can you help meĀ No, because you haven't supplied enough details for us to do so. š Latest Webdriver UDF Release Webdriver Wiki FAQs
loulou2522 Posted November 26, 2019 Posted November 26, 2019 (edited) Sorry, What details did you need ? If you want i can send you the programm by PM Ā Edited November 26, 2019 by loulou2522
Danp2 Posted November 26, 2019 Author Posted November 26, 2019 I would suggest posting the code here, but be sure to remove any username / password info. If you want me to be able to login and examine the website, then you can PM the login details to me. Latest Webdriver UDF Release Webdriver Wiki FAQs
loulou2522 Posted November 26, 2019 Posted November 26, 2019 @damp I solve my problem making delayĀ like following and after iall is workingĀ $sbutton= _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath,"//button[@id='action.save' and @name='action' and @class='btn btn-md btn-primary col-md-3 pull-right']") Local $test92 = _WD_ElementAction($sSession, $sbutton, 'click') sleep(1000) ThanksĀ Ā
Letraindusoir Posted November 29, 2019 Posted November 29, 2019 #include <Array.au3> #include 'wd_helper.au3' $_WD_DEBUG = False Global $sDesiredCapabilities Global $sSession _SetupIE() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _Example() Func _Example() _WD_Navigate($sSession, "https://docs.microsoft.com/en-us/windows/win32/controls/window-controls") $aTables = _WD_FindElement($sSession,"tag name", "table", '', True) if @error=0 then _ArrayDisplay($aTables) Else ConsoleWrite("@error=" & @error & @CRLF) EndIf EndFunc Func _SetupIE() _WD_Option('Driver', 'IEDriverServer.exe') _WD_Option('Port', 5555) _WD_Option('DriverParams', '--log-file=' & @ScriptDir & '\IE.log') $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' EndFunc ;==>_SetupIE An error occurred after running the above code, as follows: expandcollapse popup_WDStartup: OS : WIN_7 WIN32_NT 7601 Service Pack 1 _WDStartup: AutoIt: 3.3.14.2 _WDStartup: WD.au3: 0.1.0.19 _WDStartup: Driver: IEDriverServer.exe _WDStartup: Params: --log-file=I:\IE.log _WDStartup: Port : 5555 __WD_Post: URL=HTTP://127.0.0.1:5555/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}} __WD_Post: StatusCode=200; ResponseText={ "value" : { "capabilities" : { "acceptInsecureCerts" : false, "browserName" : "internet explorer", "browserVersion" : "11", "pageLoadStrategy" : "normal", "platformName" : "windows", "proxy" : {}, "se:ieOptions" : { "browserAttachTimeout" : 0, "elementScrollBehavior" : 0, "enablePersistentHover" : true, "ie.browserCommandč”.witches" : "", "ie.ensureCleanSession" : false, "ie.fileUploadDialogTimeout" : 3000, "ie.forceCreateProcessApi" : false, "ignoreProtectedModeSettings" : false, "ignoreZoomSetting" : false, "initialBrowserUrl" : "http://localhost:5555/", "nativeEvents" : true, "requireWindowFocus" : false }, "setWindowRect" : true, "timeouts" : { "implicit" : 0, "pageLoad" : 300000, "script" : 30000 }, "unhandledPromptBehavior" : "dismiss" }, "sessionId" : "b8a652a9-be13-4ec2-8fa9-24a36795371a" } } _WD_CreateSession: { "value" : { "capabilities" : { "acceptInsecureCerts" : false, "browserName" : "internet explorer", "browserVersion" : "11", "pageLoadStrategy" : "normal", "platformName" : "windows", "proxy" : {}, "se:ieOptions" : { "browserAttachTimeout" : 0, "elementScrollBehavior" : 0, "enablePersistentHover" : true, "ie.browserCommandč”.witches" : "", "ie.ensureCleanSession" : false, "ie.fileUploadDialogTimeout" : 3000, "ie.forceCreateProcessApi" : false, "ignoreProtectedModeSettings" : false, "ignoreZoomSetting" : false, "initialBrowserUrl" : "http://localhost:5555/", "nativeEvents" : true, "requireWindowFocus" : false }, "setWindowRect" : true, "timeouts" : { "implicit" : 0, "pageLoad" : 300000, "script" : 30000 }, "unhandledPromptBehavior" : "dismiss" }, "sessionId" : "b8a652a9-be13-4ec2-8fa9-24a36795371a" } } __WD_Post: URL=HTTP://127.0.0.1:5555/session/b8a652a9-be13-4ec2-8fa9-24a36795371a/url; $sData={"url":"https://docs.microsoft.com/en-us/windows/win32/controls/window-controls"} __WD_Post: StatusCode=200; ResponseText={ "value" : null } _WD_Navigate: { "value" : null } __WD_Post: URL=HTTP://127.0.0.1:5555/session/b8a652a9-be13-4ec2-8fa9-24a36795371a/elements; $sData={"using":"tag name","value":"table"} __WD_Post: StatusCode=404; ResponseText={ "value" : { "data" : null, "error" : "no such window", "message" : "Currently focused window has been closed.", "stacktrace" : "" } } [_WD_FindElement: { "value" : { "data" : null, "error" : "no such window", "message" : "Currently focused window has been closed.", "stacktrace" : "" } }] @error=9 why? thanks in advanceļ¼
Letraindusoir Posted November 29, 2019 Posted November 29, 2019 In addition, what does it mean to appear ļ¼ This is the initial start page for the WebDriver server. and how to keep it from being displayed?
Danp2 Posted November 29, 2019 Author Posted November 29, 2019 @Letraindusoir Sorry, but haven't really worked with IE and this UDF. You may want to review @Chimp's post here. P.S. Might be beneficial to know the version of the IE driver that you are using P.P.S. You are a couple releases behind on the Webdriver UDF Latest Webdriver UDF Release Webdriver Wiki FAQs
Letraindusoir Posted November 30, 2019 Posted November 30, 2019 no such window Currently focused window has been closedļ»æ. I don't know what that means....
Letraindusoir Posted November 30, 2019 Posted November 30, 2019 20 hours ago, Danp2 said: @Letraindusoir Sorry, but haven't really worked with IE and this UDF. You may want to review @Chimp's post here. P.S. Might be beneficial to know the version of the IE driver that you are using P.P.S. You are a couple releases behind on the Webdriver UDF thanksļ¼Danp2
nguyenthaiytcc Posted December 1, 2019 Posted December 1, 2019 (edited) Dear @Danp2I am new and I look forward to your support in this regard:I saw the example in the demo file and it seems that it only has an example of WD_Action with mouse:$sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"'$sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}'I want to send the {pagedown} key in WD, what should I do?Thank you! Edited December 1, 2019 by nguyenthaiytcc
loulou2522 Posted December 1, 2019 Posted December 1, 2019 (edited) How can i change the select option with the following sentenceĀ <div role="combobox" class="v-filterselect v-widget v-has-width" style="width: 20em;"> <input type="text" class="v-filterselect-input" autocomplete="nope" id="gwt-uid-3" aria-labelledby="gwt-uid-2" tabindex="0" dir="" style="width: 100%;"> <div class="v-filterselect-button" aria-hidden="true" role="button"></div></div> My codeĀ $sTouche =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='gwt-uid-3']") _WD_ElementAction($sSession, $sTouche, 'property','') _ChromeSetInputValueById($sSession,'gwt-uid-3','English') And the debuggerĀ __WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element; $sData={"using":"xpath","value":"//input[@id='gwt-uid-3']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}} __WD_Get: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element/5472b4ed-0b82-4bf2-b75f-4fbde4f8a117/property/ __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element; $sData={"using":"xpath","value":"//input[@id='gwt-uid-3']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/4ed0969e6701ee585ee758f05deb98f3/element/5472b4ed-0b82-4bf2-b75f-4fbde4f8a117/value; $sData={"id":"5472b4ed-0b82-4bf2-b75f-4fbde4f8a117", "text":"English"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null}... +>15:21:34 AutoIt3.exe ended.rc:0 +>15:21:34 AutoIt3Wrapper Finished. >Exit code: 0 Time: 22.66 Beforei have "Deutsch" in the input and after i have DeutschEnglish in the fieldsĀ Ā Edited December 1, 2019 by loulou2522
Danp2 Posted December 1, 2019 Author Posted December 1, 2019 @nguyenthaiytcc This isn't something that I've needed to do previously, but I believe this would be the basic syntax -- $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE00F"}, {"type": "keyUp", "value": "\uE00F"}]}]}' _WD_Action($sSession, "actions", $sAction) Please give it a try and report back with your results. SkysLastChance 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
nguyenthaiytcc Posted December 1, 2019 Posted December 1, 2019 Thanks @Danp2, I have solved my problem by reading all page in this topic Anyway, thanks for your support!
Danp2 Posted December 1, 2019 Author Posted December 1, 2019 @loulou2522 I suggest that you post a short reproducer that we can actually run to observe whatever issue you are encountering. P.S. No idea what the 2nd line is supposed to be doing. If you are attempting to clear the prior value, this this would make more sense -- _WD_ElementAction($sSession, $sTouche, 'clear') Ā Latest Webdriver UDF Release Webdriver Wiki FAQs
loulou2522 Posted December 1, 2019 Posted December 1, 2019 $sSession = _WD_CreateSession($sDesiredCapabilities) ;_WD_Window($sSession, 'Maximize') _WD_Navigate($sSession,"https://ubs-paymentstandards.ch/login") Sleep(1000) $sTouche =_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='gwt-uid-3']") _WD_ElementAction($sSession, $sTouche, 'clear') Sleep(2000) _ChromeSetInputValueById($sSession,'gwt-uid-3','English') Sleep(1000) exit Here is the code to reproduce this case . Hope it will be suffisant for you to show the problem Ā
Gianni Posted December 1, 2019 Posted December 1, 2019 On 11/29/2019 at 5:03 PM, Letraindusoir said: An error occurred after running the above code..... hello @Letraindusoir, your code snippet works properly here, (win 7 x64 & ie 11) have you solved your problem? Ā Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Danp2 Posted December 1, 2019 Author Posted December 1, 2019 @loulou2522 This isn't a standard web element, so it takes multiple steps to accomplish your goal. The follow example will open the web page and then switch back and forth between English and Deutsch. expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities Local $sSession, $sElement, $sElement2 SetupChrome() _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession,"https://ubs-paymentstandards.ch/login") Sleep(1000) ; Click arrow to open dropdown list $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='v-filterselect-button']") _WD_ElementAction($sSession, $sElement, 'click') ; Wait for element to be present and then click it _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'English')]", 1000) $sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'English')]") _WD_ElementAction($sSession, $sElement2, 'click') Sleep(2500) ; Click arrow to open dropdown list $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='v-filterselect-button']") _WD_ElementAction($sSession, $sElement, 'click') ; Wait for element to be present and then click it _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Deutsch')]", 1000) $sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Deutsch')]") _WD_ElementAction($sSession, $sElement2, 'click') Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"excludeSwitches": ["enable-automation"]}}}}' EndFunc Ā Latest Webdriver UDF Release Webdriver Wiki FAQs
Letraindusoir Posted December 2, 2019 Posted December 2, 2019 15 hours ago, Chimp said: hello @Letraindusoir, your code snippet works properly here, (win 7 x64 & ie 11) have you solved your problem? Yes, I can now run it correctly by searching for relevant information. However, the IE browser needs to be set in advance.ć The Configuration Required are as follows: Quote On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode". Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog. The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates. For Windows 10, you also need to set "Change the size of text, apps, and other items" to 100% in display settings. For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0. Ā
Letraindusoir Posted December 2, 2019 Posted December 2, 2019 option.setExperimentalOption("useAutomationExtension", false); option.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation")); IfĀ want to add the above parameters into [google: chromeOptions] how do write it? Ā
Recommended Posts