Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72443

geb/selenium You may only interact with visible elements

$
0
0

I'm trying to run a geb test for a grails webpage. The page displays a table. The third "td" in each table row has an internal "a href" link. the test is supposed to click on that cell. the table format is something like this

<thead>
    <tr> 
        <th>First</th> <th>Second</th> <th>Third</th> 
    </tr>
</thead>
<tbody>
    <tr> 
        <td>First</td> <td>Second</td> <td>Third <a href= "..." class="linkItem"</td> 
    </tr>
</tbody>

Basically, I want to click on the third td element in the first (and only) row of the table. I have two strategies. The first is to get all of the "td" elements and to click on the third. The second is to get all the "a" elements of class "linkItem" and click on the first element of the array. To do this, I have constructed a page object

class myPage extends Page {
    static url = "..."
    static at = {
        waitFor { title.contains("...") }
    }
    static content = {
        tableCells { $("td") }
        links { $("a.linkItem") 
    }

    void clickLink() {
        links[0].click()
    }
    void clickCell() {
        tableCells[2].click()
    }
}

When I run this test, I get the following error:

org.openqa.selenium.ElementNotInteractableException: You may only interact with visible elements
...
Driver info: driver.version: unknown

Based on similar questions posted on SO about this error, I suspect it may be an issue with the selenium-htmlunit-driver, but I don't understand exactly why, or how to determine the correct version to use. My build.gradle dependency looks like this:

testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.35.0"
testRuntime 'net.sourceforge.htmlunit:htmlunit:2.35.0'
testCompile "org.seleniumhq.selenium:htmlunit-driver:2.35.1"

I can click on buttons, links and check text and values elsewhere on the page, but when I try to access elements in this table row, I get this error.


Viewing all articles
Browse latest Browse all 72443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>