خرید بک لینک

Vote count: 0

I'm trying to click a button that doesn't have any unique identifiers from the other buttons in a list, the list is also being refreshed every few seconds. I've tried grabbing all of the identifiers in the element but it's not working. I've attached the test that's written so far and also a small segment of the HTML that I'm testing.

Here's the HTML for the test:

<div id="lobby_rooms">
    <div id="room_list" class="list-group">
        <a class="list-group-item game_ended" tabindex="-1" href="#" data-room-id="example-multiplayer-game-vipshack" data-room-name="VIP Shack">
            <h4 class="list-group-item-heading">VIP Shack
        <span class="badge">0</span>
      </h4>
            <p class="list-group-item-text"></p>
        </a>
        <a class="list-group-item waiting" tabindex="-1" href="#" data-room-id="example-multiplayer-game-twilightpad" data-room-name="Twilight Pad">
            <h4 class="list-group-item-heading">Twilight Pad<span class="badge">0</span></h4>
            <p class="list-group-item-text"></p>
        </a>
        <a class="list-group-item waiting" tabindex="-1" href="#" data-room-id="example-multiplayer-game-bustlingdivision" data-room-name="Bustling Division">
            <h4 class="list-group-item-heading">Bustling Division<span class="badge">0</span></h4>
            <p class="list-group-item-text"></p>
        </a>

the code carries on with listing other rooms after that.

And here is the test that I have written for it at the moment:

roomlist = @third_browser.iframe(:id , 'iconsole-plugin-session_iframe__').div(:id , 'lobby_rooms')
  lobby = roomlist.div(:id , 'room_list').a(:class , 'list-group-item game-ended')
  Watir::Wait.for_condition(10 , 2 , "Waiting for button to be present") {
    puts lobby.present?
  }
  lobby.click

The error that I get at the moment when I run this code is "unable to locate element, using {:class=>"list-group-item game-ended", :tag_name=>"a"}"

Ideally as this room list is updated periodically I don't want to hard code in a value, I'd rather just click the first child of the room list div, so regardless of what's entered there, it will click. I've looked on the site and I've tried some implementation with finding the button with CSS or using [1] which should click the first child, but I haven't had any success.

Any help or advice that anyone could give me would be greatly appreciated, thanks.

asked 9 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 اسفند 1394 ساعت: 23:04

صفحه بندی