How to interact with a hidden element using Serenity-BDD

Issue

What I want to achieve in my Performable is very simple, but I can’t do it due to a hidden element.

I want my actor to:

  • Click on an <input> element
  • Enter a string into that element
  • Then hit <RETURN>

My current code is:

public class Set {
    public static Performable dateFrom(String date) {
        return Task.where("{0} set 'dateFrom' filter to " + date,
            Click.on(SearchPage.dateTimePicker_from),
            Enter.theValue(date).into(SearchPage.dateTimePicker_from)
            .thenHit(RETURN)
        );
    }
}

The exact error I receive when running the test is [main] ERROR - Expected enabled element was not enabled.

I found that this is due to the <input> element being hidden (but there is a <div> element "in-front" of this <input>)

How can I click a hidden element within my Task, without requesting a change from my Dev team?

Solution

Have you tried with JavaScriptClick?

Answered By – D 5kova

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published