Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:27:05+00:00 2026-06-13T20:27:05+00:00

in the answer to this question Accessing a div element in an array of

  • 0

in the answer to this question Accessing a div element in an array of li elements
and when i look here http://wiki.openqa.org/display/WTR/Collections+of+HTML+Elements

I dont see or don’t understand what i need to do

what i am trying to do is make a spreadsheet with my guilds player_name, player_id and player_lvl.

this is the page that has the guild members. guild page
her is some sample of the html

<div class="guild_board">

<div class="item_box_guild" data-playerid="1256824509">
   <a onclick="doCmd(81,{'player_id':'1256824509'})"><div class="tile_50">
 <div class="avatar_container_50">
 <div class="avatar_image" style="background-image:url(//assets.ageofchampions.com/avatar/09/45/82/56/12/avatar_1351896996145.png);">
 </div>
</div>
 <div class="over">
   <img src="http://profile.ak.fbcdn.net/hprofile-ak-ash4/187582_1256824509_1172546357_q.jpg">
 </div>
<div class="lock"></div>
 </div>
</a>
 <div class="content">
  <div class="stat" style="width:225px;">
    <a onclick="doCmd(81,{'player_id':'1256824509'})">~|SR|~ Kariselle</a> |
        Level 348 <hr>
          Battle Score: 23,951,169

this code works to get the first member and i could do (=>index (2)) to get the next member and so on. at the momunt we only have 10 members but it could get alot bigger. and if i dont have to I dont want to have to write this for each member.

require 'rubygems'
require 'watir-webdriver'
require 'google_drive'
b = Watir::Browser.new
b.goto 'http://game.ageofchampions.com/aoc/?cmd%5B0%5D=112&guild_id=138668'
b.text_field(:id => 'email').set 'email'
b.text_field(:id => 'pass').set 'psswd'
b.button(:name => 'login').click
session = GoogleDrive.login('username', 'pass')
ws=session.spreadsheet_by_key('spreadsheethe').worksheets[0]
b.goto 'game.ageofchampions.com/aoc/?cmd%5B0%5D=112&guild_id=138668'
#b.divs(:class => 'item_box_guild').each do |div|
playerid_1 = b.div(:class => 'item_box_guild').attribute_value(:'data-playerid')
#playerid_1a = puts attribute_value(:'data-playerid')
#end
playername_1 = b.div(:class => 'item_box_guild').div(:class => 'stat').a.text
#playerlvl_1 = b.div(:class => 'item_box_guild').div(:class => 'stat').text
#layerlvl_1a = playerlvl_1\s+id="0"\s+value="(.+?)"
# Gets content of A2 cell.
p ws[2, 1]  #==> "hoge"

# Changes content of cells.
# Changes are not sent to the server until you call ws.save().
ws[1, 1] = "PLAYER ID"
ws[1, 2] = "CHAMPIONS NAME"
ws[1, 3] = "LEVEL"
ws[2, 1] = playerid_1
ws[2, 2] = playername_1
ws[2, 3] = "still working on lvl"
ws[3, 1] = "does this"
ws[3, 2] = "still"
ws[3, 3] = "work"

ws.save()

# Dumps all cells.
for row in 1..ws.num_rows
for col in 1..ws.num_cols
p ws[row, col]
end
end

# Yet another way to do so.
#p ws.rows  #==> [["fuga", ""], ["foo", "bar]]

# Reloads the worksheet to get changes by other clients.
ws.reload()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:27:07+00:00Added an answer on June 13, 2026 at 8:27 pm

    You want to get a collection of the players when you do:

    b.divs(:class => 'item_box_guild')
    

    When you iterate over each with:

    b.divs(:class => 'item_box_guild').each do |div|
    

    The variable div will be a div in the collection. Inside the iteration, you want to refer to div rather than b.div(:class => 'item_box_guild') to get each player.

    Try doing this:

    b.divs(:class => 'item_box_guild').each do |plaher_div|
      playerid = player_div.attribute_value(:'data-playerid')
      puts playerid
      #=> This will be 'player1' during the first iteration, 'player2' during the second, etc.
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this fiddle : http://jsfiddle.net/m7q3H/52/ I'm accessing the html returned within the div toupdate.
While trying to answer this question I found that the code int* p =
Also can you please answer this question? how do I get co-ordinates of selected
The manual does not answer this question : it says the name of the
While trying to answer this question I found without () (which invokes C++ most
(Came up with this question in the course of trying to answer this other
Thanks in Advance for reading and answer this question. I got button in asp
I have a job interview tomorrow and I'm trying to answer this question: There
I'm trying to write a SQL or ActiveRecord query to answer this question: Of
In this answer to this question , Lachlan-Hunt writes the following: With HTML5, you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.