Jump to content

Send keyboard command in webdriver


Recommended Posts

Yes but, I don't understand how I can send two keys at the same time

 

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

Or so would it work?

saying that the Key_Down the SHIFT and in the Key_Up the ENTER

$sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE008"}, {"type": "keyUp", "value": "\uE007"}]}]}'
_WD_Action($sSession, "actions", $sAction)
Link to comment
Share on other sites

I have another question I have a text,

 

Line texto 1

Line texto 2

Line texto 3

Line texto 4

 

I would like to send this text with these line breaks but when I use _WD_ElementAction ($ sSession, $ sElement, "value", "Text") it sends me the line breaks as an ENTER, I would like to know how I can make it just send me the jump of line and to be able to send this text in a single paragraph, and not separated.

Link to comment
Share on other sites

The sending of keys does not work for me, try like this

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

and also like this

$sAction = '{"actions": [{"type": "key","id": "keyboard","actions": [{"type": "keyDown", "value": "\uE008"},{"type": "keyDown", "value": "\uE007"},{"type": "keyUp", "value": "\uE008"},{"type": "keyUp", "value": "\uE007"}]}]}'
$_WD_Action = _WD_Action($sSession, "actions", $sAction)

but none worked for me

Link to comment
Share on other sites

"Does not work" isn't an adequate description for us to diagnose the issue. Does the code execute without any errors?

 

3 hours ago, Danp2 said:

If that doesn't work, then I would recommend that you post a short script that we can run to observe the issue.

Do this please is you want me to look further into this for you.

Link to comment
Share on other sites

I already found the way to send the key combination, thank you very much for your help, I could not send an example code, since I did not find a page similar to the one I am testing, since the page is from work. I send the form that I found that is part of how you explained to me.

 

_ChromeXPathComandByXPath($sSession, "SearchXpath", "value", "\uE008\uE007")

Func _ChromeXPathComandByXPath($sSession, $XPath, $Value, $Option = "")
 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $XPath)
 $cResult = _WD_ElementAction($sSession,$sButton, $Value , $Option)
 Return $cResult
EndFunc

 

So I send a SHIFT + ENTER that gives me a line break where it does not accept the jump with just the enter.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...