• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Foreman
Posts: 880
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Foreman
Posts: 880
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You pass the string it returns to sendKeys

So you'd write:

 
kevin Abel
Ranch Foreman
Posts: 880
8
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,
I appreciate the reply.  I could not tell the syntax from looking at the link.
Thanks,
Kevin
 
We noticed he had no friends. So we gave him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic