Jump to content

ControlClick & ControlSend for Webdriver UDF


Recommended Posts

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

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
#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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...