0

Is there a way to click on only the visible of all the returned elements using Fluentlenium(similar to selenium)??? For example I have

@FindBy(css = "div[class^='event-body']>button")
    public FluentWebElement hostMeeting;

This will return may buttons. Of all only one will be visible. I want to click on that.

  • 1
    Then you need to target the visible element with a better locator, surely? – Arran Mar 28 '14 at 12:45
  • in selenium we have the method element.isDisplayed() which can be used in your case. – StrikerVillain Mar 28 '14 at 13:02
  • @Arran AFAIK, there's no better locator, since the only thing unique is another button, which is child element of parent element of this element. –  Mar 28 '14 at 13:09
  • @lost That's not working, I don't know why –  Mar 28 '14 at 13:36
  • Perhaps share the HTML so we can see how these two buttons actually relate to each other. – Arran Mar 28 '14 at 14:53
  • Well surely you are clicking on the overall "ClickThisMeeting" element to *expand* it *first* right? – Arran Mar 28 '14 at 16:26
  • Yeah, I am clicking on that element before clicking on start meeting button –  Mar 28 '14 at 18:19

1 Answers1

0

The goal here is to find how it hides the elements. Usually, this would be the inline style attribute. It would be something like:

<div class="event-body something">
  <button style="display: none;" />
  ...
</div>

You'd match it by editing your CSS selector:

div.event-body > button:not([style*='display:none'])
ddavison
  • 28,221
  • 15
  • 85
  • 110
  • this is the element. Every other element is similar –  Mar 28 '14 at 13:18
  • so if the class `host-meeting` is causing it, (you can test that by removing it via console.) then change my selector to be `class~='host-meeting'` – ddavison Mar 28 '14 at 13:19
  • the element which i want to click also belong to the same class. They are differed only by rel(which will change every time) and visibilty –  Mar 28 '14 at 13:33