I want to be an order
the way they are situated in screen, Is it possible to get like that?
RAJ
There are some ideas on sorting IDs here, you should be able to collect
the objects using the loop and then sort them using one of these sorting
methods.
textbox and textarea are both covered by text_field. If you specifically
want a textarea, use textarea.
No no i am not asking about the sorted one, But the order the objects
are placed in the webpage,
For an example,
textbox(id : a) combobox(id :z) textbox(id : b)
now it has to print the id
a
z
b.
But what it actually doing is,it print the textbox id first,and then it
print the combobox id like
a
b
z
But I want the first order
azb.
Can you bring this?
RAJ
As I said,
Collect the objects in the initial loop.
Sort the collection of objects based on their position in the page using
one of the methods given in the link, or create your own approach using
the ideas on that page.
Then iterate through your sorted collection, happy in the knowledge that
they are now in page order.
Hi, Have you ever used the test-factory? If so, can you tell me how it
helps to our testing?
RAJ
Never used it. It looks interesting though, I’ll have a look.
At a glance I’d say that if you learn how to use it you’ll save yourself
some time writing test scripts.
Am 29.03.2013 12:04, schrieb Raj pal:
Hi, Have you ever used the test-factory? If so, can you tell me how it
helps to our testing?
RAJ
Please start a different thread for questions that are not related.
Never used it. It looks interesting though, I’ll have a look.
At a glance I’d say that if you learn how to use it you’ll save yourself
some time writing test scripts.
Ok Thank you, and I will start a new thread.
RAJ
hi,
Ruby has any Date validation function? Or do you have any function for
date validation?
RAJ
I don’t know exactly what you mean by date validation, but Ruby has
this:
require ‘date’
Date.today
Date.new( 2013, 4, 3 )
etcetera…
hi,
what I meant was, in the date field, I should not enter “raja”, if i
enter it has to print on the console ,it’s not valid date.
RAJ
It depends whether you mean a Date object or a string in date format. If
you want to validate I tend to use Regexp for that sort of thing.
Here’s a Regexp example which covers a variety of date-string formats:
use like this:
if my_date !~ /\d{1,2}[-/]\d{1,2}[-/]\d{4}/
fail TypeError, 'Invalid date: ’ + my_date
end
For a Date object it’s just:
my_date.is_a?( Date )
hi,
the gmail,
If i have to automate the gmail account, then I will write the code like
begin
$browser.text_field(:id,‘Gmail’).set(‘raja’)
rescue =>e
puts e.message
puts e.backtrace
end
begin
$browser.text_field(:id,‘password’).set(‘raja’)
rescue =>e
puts e.message
puts e.backtrace
end
Likewise, if i have to automate 1000field, then it would 4000 lines of
code, Is there any way could I able to put into the loop. My problem is,
i couldn’t able to synchronize the id and value.Do you have any solution
for this?
RAJ
Raj pal wrote in post #1104349:
if i have to automate 1000field, then it would 4000 lines of
code, Is there any way could I able to put into the loop. My problem is,
i couldn’t able to synchronize the id and value.Do you have any solution
for this?
Something like this should work.
my_hash = {
User1: ‘Pass1’,
User2: ‘Pass2’
}
my_hash.each do |username, password|
$browser.text_field(:id,‘Email’).set(username.to_s)
$browser.text_field(:id,‘Passwd’).set(password)
#Other stuff here…
end
hi Is there any way can I focus on to the text box through the program,
More closely put,I have to bring cursor pointer to the specific textbox.
Can you explain what you’re trying to achieve by this? It’s sometimes
convenient for Watir not to steal focus, and I don’t think this is how
it operates; so is this your end-goal, or a stepping stone towards
something else?
i have written a code to dynamically generate the id,but i don’t have to
make that sychronise into the column in the spread sheet. so I decided
to enter the value manually. So if I know the corresponding textbox,
then i will enter the value manually and then full code will be
generated,
look at this example,
b.text_field(:id,‘generated dynamically’).set(entered manually)
RAJ
this is interesting,
b.text_field(:id,from spreadsheet).set(from spreadsheet)
But how do you know "from spreadsheet"part from spreadsheet? because id
is the screen dependent,isn’t it so?
RAJ