[wtr-general] Re: How to Trace the change in a field
The xpath for the html html counter change1 is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ td[2]/div On Mar 3, 2:17 pm, Ashu wrote: > hi, > there is a field on the php page that keeps track of the change in > counter field. > On every next refresh the value changes of that variable. > Change counter > 1 > The "1" in the above code determines that one transaction has taken > place and it continues to increase up on every transaction update. > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to Trace the change in a field
Find a way to determine the value of and assign it to a variable. On Mar 3, 1:35 am, Ashu wrote: > The xpath for the html > html counter change class="normal">1 > > is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ > td[2]/div > > On Mar 3, 2:17 pm, Ashu wrote: > > > > > > > > > hi, > > there is a field on the php page that keeps track of the change in > > counter field. > > On every next refresh the value changes of that variable. > > Change counter > > 1 > > The "1" in the above code determines that one transaction has taken > > place and it continues to increase up on every transaction update. > > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to Trace the change in a field
ya I agree with Orde well my testing page contains multiple "" with same class = normal and div contains class = system for every "" On Mar 3, 10:27 am, orde wrote: > Find a way to determine the value of and assign > it to a variable. > > On Mar 3, 1:35 am, Ashu wrote: > > > The xpath for the html > > html counter change > class="normal">1 > > > is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ > > td[2]/div > > > On Mar 3, 2:17 pm, Ashu wrote: > > > > hi, > > > there is a field on the php page that keeps track of the change in > > > counter field. > > > On every next refresh the value changes of that variable. > > > Change counter > > > 1 > > > The "1" in the above code determines that one transaction has taken > > > place and it continues to increase up on every transaction update. > > > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to Trace the change in a field
If I read you correctly, the challenge is "get the contents of the second cell on the table row where the first cell is 'change counter'" is that right? Presuming that "change counter" appears nowhere else in that table, AND that you have some way to identify the table itself, or a container that holds the table browser.table(:how, "what").row(:text, /counter change/).cell(:index, 2).text if there is no other row in any other table that contains 'counter change' then you might even be able to do it by going straight to the row and not worrying about the table element. browser.row(:text, /counter change/).cell(:index, 2).text To understand why that works, do some googling and reading about something called 'regular expressions' PS for challenges like this, a tiny bit more of the HTML such as details on the table, can be useful in terms of people being able to give you better examples of the code you would need to use. The more details you put into a question on the group, the more likely you are to get a more 'exact' answer instead of a generic one. On Mar 3, 10:57 am, Ashu wrote: > ya I agree with Orde > > well my testing page contains multiple "" with same class = normal > and div contains class = system for every "" > > On Mar 3, 10:27 am, orde wrote: > > > Find a way to determine the value of and assign > > it to a variable. > > > On Mar 3, 1:35 am, Ashu wrote: > > > > The xpath for the html > > > html counter change > > class="normal">1 > > > > is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ > > > td[2]/div > > > > On Mar 3, 2:17 pm, Ashu wrote: > > > > > hi, > > > > there is a field on the php page that keeps track of the change in > > > > counter field. > > > > On every next refresh the value changes of that variable. > > > > Change counter > > > > 1 > > > > The "1" in the above code determines that one transaction has taken > > > > place and it continues to increase up on every transaction update. > > > > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to Trace the change in a field
Yes, you are right Chunk, My HTML code looks like this - /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/Change counter0 I have tried as suggested by you, It gives me following error... C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ jssh_socket.rb:12:in `const_get': wrong number of arguments (2 for 1) (ArgumentError) from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jssh_socket.rb:12:in `js_eval' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/element.rb:997:in `text' from C:/Documents and Settings/tcsadmin/Desktop/ check_changecounter.rb:9 On Mar 4, 10:23 pm, Chuck van der Linden wrote: > If I read you correctly, the challenge is "get the contents of the > second cell on the table row where the first cell is 'change counter'" > is that right? > > Presuming that "change counter" appears nowhere else in that table, > AND that you have some way to identify the table itself, or a > container that holds the table > > browser.table(:how, "what").row(:text, /counter change/).cell(:index, > 2).text > > if there is no other row in any other table that contains 'counter > change' then you might even be able to do it by going straight to the > row and not worrying about the table element. > > browser.row(:text, /counter change/).cell(:index, 2).text > > To understand why that works, do some googling and reading about > something called 'regular expressions' > > PS for challenges like this, a tiny bit more of the HTML such as > details on the table, can be useful in terms of people being able to > give you better examples of the code you would need to use. The more > details you put into a question on the group, the more likely you are > to get a more 'exact' answer instead of a generic one. > > On Mar 3, 10:57 am, Ashu wrote: > > > ya I agree with Orde > > > well my testing page contains multiple "" with same class = normal > > and div contains class = system for every "" > > > On Mar 3, 10:27 am, orde wrote: > > > > Find a way to determine the value of and assign > > > it to a variable. > > > > On Mar 3, 1:35 am, Ashu wrote: > > > > > The xpath for the html > > > > html counter change > > > class="normal">1 > > > > > is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ > > > > td[2]/div > > > > > On Mar 3, 2:17 pm, Ashu wrote: > > > > > > hi, > > > > > there is a field on the php page that keeps track of the change in > > > > > counter field. > > > > > On every next refresh the value changes of that variable. > > > > > Change counter > > > > > 1 > > > > > The "1" in the above code determines that one transaction has taken > > > > > place and it continues to increase up on every transaction update. > > > > > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: How to Trace the change in a field
That doesn't look like HTML to me, it looks like an xpath. Show us the actual HTML for the page, Show me line 12 of your attempt to use the code I suggested, since that is where the error is On Mar 7, 1:26 am, Ashu wrote: > Yes, you are right Chunk, > My HTML code looks like this - > /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ class="normal">Change counter class="system">0 > > I have tried as suggested by you, > It gives me following error... > C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ > jssh_socket.rb:12:in `const_get': wrong number of arguments (2 for 1) > (ArgumentError) > from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ > firewatir/jssh_socket.rb:12:in `js_eval' > from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ > firewatir/element.rb:997:in `text' > from C:/Documents and Settings/tcsadmin/Desktop/ > check_changecounter.rb:9 > > On Mar 4, 10:23 pm, Chuck van der Linden wrote: > > > If I read you correctly, the challenge is "get the contents of the > > second cell on the table row where the first cell is 'change counter'" > > is that right? > > > Presuming that "change counter" appears nowhere else in that table, > > AND that you have some way to identify the table itself, or a > > container that holds the table > > > browser.table(:how, "what").row(:text, /counter change/).cell(:index, > > 2).text > > > if there is no other row in any other table that contains 'counter > > change' then you might even be able to do it by going straight to the > > row and not worrying about the table element. > > > browser.row(:text, /counter change/).cell(:index, 2).text > > > To understand why that works, do some googling and reading about > > something called 'regular expressions' > > > PS for challenges like this, a tiny bit more of the HTML such as > > details on the table, can be useful in terms of people being able to > > give you better examples of the code you would need to use. The more > > details you put into a question on the group, the more likely you are > > to get a more 'exact' answer instead of a generic one. > > > On Mar 3, 10:57 am, Ashu wrote: > > > > ya I agree with Orde > > > > well my testing page contains multiple "" with same class = normal > > > and div contains class = system for every "" > > > > On Mar 3, 10:27 am, orde wrote: > > > > > Find a way to determine the value of and assign > > > > it to a variable. > > > > > On Mar 3, 1:35 am, Ashu wrote: > > > > > > The xpath for the html > > > > > html counter change > > > > class="normal">1 > > > > > > is xpath /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/ > > > > > td[2]/div > > > > > > On Mar 3, 2:17 pm, Ashu wrote: > > > > > > > hi, > > > > > > there is a field on the php page that keeps track of the change in > > > > > > counter field. > > > > > > On every next refresh the value changes of that variable. > > > > > > Change counter > > > > > > 1 > > > > > > The "1" in the above code determines that one transaction has taken > > > > > > place and it continues to increase up on every transaction update. > > > > > > I am unable to figure out the logic to keep track of the change. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com