ruby - Is it possible to select or highlight a substring of text within a text box using watir? -


I'm relatively new to Ruby and water, but I am trying to create a Ruby script that answered a string The selected subset will select a text box out.

Example string given:

 "here here!"  

"I here want to be able to choose the second instance of" I

I water-Vebdraivr /'m thinking extensions /'m using select_text.rb that I can use it I can fulfill my goal but as far as I can tell, he can choose the first match text of only one element. I was hoping for things that could have started and ended up in the index and could only select those characters. Does anyone know that something similar in Ruby is like this?

Save the text to a variable.

You say your variable test_string = "here is here!"

Now it .split to split it like Method

word = test_string.split ( "")

words is an array whose content here to index 0 and here! on index 1 (Array starts in zero in any language)

Now you can call any instance you want. If you need another, then get it this way:

speaks the word [1] It will give you here!

  test_string = "here here!" Word = test_string.split ( "") the word puts [1]   

OR

  test_string = @browser .___ your_locator __. The text word = test_string.split ("") is called the word [1]    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -