-3

I want to simulate a real life scenario of selecting words in wordsearch online games. example word needs to be find is "School",,then I will click on the letter S and move towards rightside where letters C H O O L is present,On selecting/finding the word server will say successs.

consider I have identified the word,now want to clickon letter S and move towards right to select C H O O L.

how to do it ?

HTML:

<tbody> 
    <tr> 
        <td class="rf-tgrid">G</td>
        <td class="rf-tgrid">S</td>
        <td class="rf-tgrid">T</td>
        <td class="rf-tgrid">J</td>
        <td class="rf-tgrid">Z</td>
        <td class="rf-tgrid">N</td>
        <td class="rf-tgrid">P</td>
        <td class="rf-tgrid">H</td>
        <td class="rf-tgrid">M</td>
        <td class="rf-tgrid">C</td>
    </tr> 
    <tr> 
        <td class="rf-tgrid">S</td>
        <td class="rf-tgrid">N</td>
        <td class="rf-tgrid">N</td>
        <td class="rf-tgrid">A</td>
        <td class="rf-tgrid">L</td>
        <td class="rf-tgrid">V</td>
        <td class="rf-tgrid">F</td>
        <td class="rf-tgrid">X</td>
        <td class="rf-tgrid">H</td>
        <td class="rf-tgrid">K</td>
    </tr> 
Fractaliste
  • 5,777
  • 11
  • 42
  • 86

1 Answers1

0

This should work, Apologies if there is any syntax errors, don't have a Java IDE

List<WebElement> allLetters= dropDown.findElements(By.className("rf-tgrid"));

for ( WebElement we: allLetters) { 
    if ( we.getText().contains( "Your school letters in some sort of List<> or Array[]"))
    {
       Actions action = new Actions(webdriver);
       action.moveToElement(we).click().build().perform();
    }

Something like that should work.

Jamie Rees
  • 7,973
  • 2
  • 45
  • 83