• Post Reply Bookmark Topic Watch Topic
  • New Topic

Selenium - How do I select/highlight all the code on the display?  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with Selenium Web Driver
Something looks wrong with the CONTROL+A part of the code below.  How do I highlight/select all of the text on the display?




Thanks,

Kevin
 
author & internet detective
Marshal
Posts: 37896
594
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin,
What you are trying to do is simulate pressing multiple keys at once. This is called a chord. Selenium provides a method to create a key chrord of as many characters "pressed" simulantaneously as you want.

Also, I've moved this post to our testing forum.
 
kevin Abel
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appreciate the assistance Sheriff Jeanne.

I located the Testing area of the forum by clicking on the ALL FORUMS button. Then the page shows up showing all of the forums.  Testing is under Engineering. Now I know where to place my threads. 

I'm looking at the link for Java Chord.  It shows the information below for how to use it.  There is a second chord example but it mentions iterative so I don't think I need that one.. 

The guess I made inside of Eclipse IDE is:
string A = public static java.lang.String chord("CTRL+A")  but it light up with all kinds of errors. 
I googled Java Chord but the hits received had to do with music chords written with JAVA.  
I tried this and the Chord part has a red underline:
String A = chord("CTRL+A");
I can use an example of how to use the chord.
Thanks,
Kevin


public static java.lang.String chord(java.lang.CharSequence... value)
Simulate pressing many keys at once in a "chord". Takes a sequence of Keys.XXXX or strings; appends each of the values to a string, and adds the chord termination key (Keys.NULL) and returns the resultant string. Note: When the low-level webdriver key handlers see Keys.NULL, active modifier keys (CTRL/ALT/SHIFT/etc) release via a keyup event. Issue: http://code.google.com/p/webdriver/issues/detail?id=79
Parameters:
value - characters to send
Returns:
String representation of the char sequence
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37896
594
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You pass the string it returns to sendKeys

So you'd write:

 
kevin Abel
Ranch Hand
Posts: 47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,
I appreciate the reply.  I could not tell the syntax from looking at the link.
Thanks,
Kevin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!