MRAJ 2 Posted September 8, 2020 Share Posted September 8, 2020 ControlClick($hWnd, "", "Intermediate D3D Window1","left",669,408,2) ControlSend($hWnd, "", "Intermediate D3D Window1", "{TAB}") Sleep(1000) ControlSend($hWnd, "", "Intermediate D3D Window1", "{ENTER}") Hello, I tried to use the control send and control click in my edge browser using WD UDF, but it is not working. I am already using the commands in IE browser and its working. Any difference for using Control commands for different browser or it is same for all. Link to post Share on other sites
Danp2 1,227 Posted September 8, 2020 Share Posted September 8, 2020 This doesn't make any sense to me. Why would you want to use these commands with a web browser? What are you trying to accomplish? Please be specific. 🙂 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
MRAJ 2 Posted September 8, 2020 Author Share Posted September 8, 2020 When i will give the website in browser, it will open the form where i have to fill details and then i have to click on Request to go next page. Below is the HTML code for that : <input type="submit" class="btn btn-primary" value="Request"> I tried to use some of the commands but it is not working, so i used the control command to hit enter on Request. Link to post Share on other sites
Danp2 1,227 Posted September 8, 2020 Share Posted September 8, 2020 If you want assistance getting this working with the Webdriver UDF, show us your "not working" code. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
MRAJ 2 Posted September 8, 2020 Author Share Posted September 8, 2020 expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" $_WD_DEBUG = $_WD_DEBUG_None ; Could also use $_WD_DEBUG_Error Local $sDesiredCapabilities, $sSession, $sElement SetupEdge() _WD_Startup() Sleep(2000) _WD_ConsoleVisible() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession,$URL) Sleep(2000) $sUsername = _WD_GetElementById($sSession,"userid") _WD_SetElementValue($sSession,$sUsername, "abc") Sleep(2000) $sEmail = _WD_GetElementById($sSession,"email") _WD_SetElementValue($sSession,$sEmail, "abc.com") Sleep(2000) ;For hitting enter on Request button Local $hWnd = WinWait("Microsoft? Edge","",5) WinActivate($hWnd) ControlClick($hWnd, "", "Intermediate D3D Window1","left",669,408,2) ControlSend($hWnd, "", "Intermediate D3D Window1", "{TAB}") Sleep(1000) ControlSend($hWnd, "", "Intermediate D3D Window1", "{ENTER}") Func SetupEdge() _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace (@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}' EndFunc _WD_DeleteSession($sSession) _WD_Shutdown() This is the code i am using WD UDF Link to post Share on other sites
MRAJ 2 Posted September 8, 2020 Author Share Posted September 8, 2020 All filling part is working, except the clicking on Request which will take you to the next page. Link to post Share on other sites
Danp2 1,227 Posted September 8, 2020 Share Posted September 8, 2020 Ok... so now drop the Win* and Control* commands and show us your attempt at using the Webdriver functions to click the Request button WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
Burgaud 3 Posted September 9, 2020 Share Posted September 9, 2020 Maybe #RequireAdmin is needed? Link to post Share on other sites
MRAJ 2 Posted September 10, 2020 Author Share Posted September 10, 2020 I tried the commands but still it is not clicking. I used even clickby text but no success. Even SCITE output not showing any error. $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='submit']") _WD_ElementAction($sSession, $sElement, 'value', "Request") _WD_ElementAction($sSession, $sButton, 'click') Link to post Share on other sites
MRAJ 2 Posted September 10, 2020 Author Share Posted September 10, 2020 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='submit']") _WD_ElementAction($sSession, $sButton, 'click') I used this but no success of clicking on Request Link to post Share on other sites
MRAJ 2 Posted September 10, 2020 Author Share Posted September 10, 2020 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit']") _WD_ElementAction($sSession, $sButton, 'click') I tried this and its working fine.:) Link to post Share on other sites
Danp2 1,227 Posted September 10, 2020 Share Posted September 10, 2020 Glad you got it working. It helps when you use the correct xpath. 😁 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
MRAJ 2 Posted September 10, 2020 Author Share Posted September 10, 2020 Thanks Dan:) Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now