Forum: Ruby Some warnings Watir webdriver/selenium/fork

Posted by Prog Rammer (proggrammer)
on 2012-10-08 22:12
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/generated.rb:1173:
warning: method redefined; discarding old data
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/button.rb:65:
warning: method redefined; discarding old element_class
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/frame.rb:71:
warning: method redefined; discarding old iframe
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/frame.rb:76:
warning: method redefined; discarding old iframes
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/image.rb:20:
warning: method redefined; discarding old width
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/image.rb:31:
warning: method redefined; discarding old height
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/input.rb:18:
warning: method redefined; discarding old type
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/option.rb:36:
warning: method redefined; discarding old selected?
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/select.rb:107:
warning: method redefined; discarding old value
/usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/table_cell.rb:10:
warning: method redefined; discarding old colspan
/usr/lib/ruby/gems/1.8/gems/facter-1.6.10/lib/facter/util/resolution.rb:200:
warning: method redefined; discarding old interpreter
/usr/lib/ruby/gems/1.8/gems/facter-1.6.10/lib/facter/util/resolution.rb:205:
warning: method redefined; discarding old interpreter=
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/capabilities.rb:188:
warning: method redefined; discarding old proxy=
/usr/lib/ruby/gems/1.8/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:100:
warning: method redefined; discarding old proxy
/usr/lib/ruby/gems/1.8/gems/childprocess-0.3.4/lib/childprocess/unix/fork_exec_process.rb:21:
warning: instance variable @cwd not initialized
/usr/lib/ruby/gems/1.8/gems/childprocess-0.3.4/lib/childprocess/unix/fork_exec_process.rb:21:
warning: instance variable @cwd not initialized


How to solve these warnings? Kindly help me a way to find solution.
Posted by Prog Rammer (proggrammer)
on 2012-10-10 13:16
why the warning? and how can I solve it?
/usr/lib/ruby/gems/1.8/gems/childprocess-0.3.4/lib/childprocess/unix/fork_exec_process.rb:21: 
warning: instance variable @cwd not initialized
Posted by Joel Pearson (virtuoso)
on 2012-10-10 13:31
Because you haven't assigned a value to @cwd, or its lost its value in 
the current scope.
Posted by Prog Rammer (proggrammer)
on 2012-10-10 20:03
Joel Pearson wrote in post #1079207:
> Because you haven't assigned a value to @cwd, or its lost its value in
> the current scope.
I have just invoked the code using a ruby script using system.
So what can I do to fix all these warning?

Or please help me with the way to supress all warnings.
Posted by Joel Pearson (virtuoso)
on 2012-10-10 20:43
If you want to temporarily suppress warnings you can try this:
http://eddymulyono.livejournal.com/65791.html

From the look of it, webdriver is overwriting its own methods every time 
you call a new process. There may be an alternative, but I've never 
tried running synchronous instances of webdriver.
Posted by Prog Rammer (proggrammer)
on 2012-10-16 12:06
Joel Pearson wrote in post #1079295:
> If you want to temporarily suppress warnings you can try this:
> http://eddymulyono.livejournal.com/65791.html
This is supressing stdout, not warnings only!! :(
> From the look of it, webdriver is overwriting its own methods every time
> you call a new process. There may be an alternative, but I've never
> tried running synchronous instances of webdriver.

I get these warning most probably because I run the script from another
script using 'system'. Any clue? how to catch and rectify it?
Posted by Joel Pearson (virtuoso)
on 2012-10-16 16:48
ajay paswan wrote in post #1079985:
> Joel Pearson wrote in post #1079295:
>> If you want to temporarily suppress warnings you can try this:
>> http://eddymulyono.livejournal.com/65791.html
> This is supressing stdout, not warnings only!! :(

Suppress stdout until the errors have passed, then restore it.

>> From the look of it, webdriver is overwriting its own methods every time
>> you call a new process. There may be an alternative, but I've never
>> tried running synchronous instances of webdriver.
>
> I get these warning most probably because I run the script from another
> script using 'system'. Any clue? how to catch and rectify it?

This is outside my area of expertise, I don't know enough about the way 
'system' works with concurrent instances of webdriver. I think some 
smaller-scale experimentation might the way to go with this; try to find 
different ways of doing the same thing, or take a different approach 
altogether.
Posted by Prog Rammer (proggrammer)
on 2012-10-17 01:35
Joel Pearson wrote in post #1080049:
> ajay paswan wrote in post #1079985:
>> Joel Pearson wrote in post #1079295:
>>> If you want to temporarily suppress warnings you can try this:
>>> http://eddymulyono.livejournal.com/65791.html
>> This is supressing stdout, not warnings only!! :(
>
> Suppress stdout until the errors have passed, then restore it.
Did not get you, kindly put some more light on it
>>> From the look of it, webdriver is overwriting its own methods every time
>>> you call a new process. There may be an alternative, but I've never
>>> tried running synchronous instances of webdriver.
>>
>> I get these warning most probably because I run the script from another
>> script using 'system'. Any clue? how to catch and rectify it?
>
> This is outside my area of expertise, I don't know enough about the way
> 'system' works with concurrent instances of webdriver. I think some
> smaller-scale experimentation might the way to go with this; try to find
> different ways of doing the same thing, or take a different approach
> altogether.
Yes thats what I was trying, and am trying, hope for the best. But there 
should be logical reasons to solve it.
Posted by Joel Pearson (virtuoso)
on 2012-10-17 10:21
ajay paswan wrote in post #1080101:
> Joel Pearson wrote in post #1080049:
>> ajay paswan wrote in post #1079985:
>>> Joel Pearson wrote in post #1079295:
>>>> If you want to temporarily suppress warnings you can try this:
>>>> http://eddymulyono.livejournal.com/65791.html
>>> This is supressing stdout, not warnings only!! :(
>>
>> Suppress stdout until the errors have passed, then restore it.
> Did not get you, kindly put some more light on it

Actually I just tried that, and webdriver seems to be ignoring the 
console redirect, it's still outputting to the console even when it 
shouldn't be.

This doesn't work, although as far as I can see it should:

_____________________________________________________
orig_std_out = STDOUT.clone #Make a record of the default console output
$stdout.reopen("Rubylog.txt", "w") #Create / overwrite logfile
$stdout.sync = true #Allow interception of console output
$stderr.reopen($stdout) #Pass errors to logfile

require 'watir-webdriver'
puts('goes to file')

b = Watir::Browser.new #This generates a log from the driver

# restore stdout
$stdout = orig_std_out
puts('goes to stdout')
b.close
_____________________________________________________
Posted by Prog Rammer (proggrammer)
on 2012-10-17 15:27
Joel Pearson wrote in post #1080136:
> ajay paswan wrote in post #1080101:
>> Joel Pearson wrote in post #1080049:
>>> ajay paswan wrote in post #1079985:
>>>> Joel Pearson wrote in post #1079295:
>>>>> If you want to temporarily suppress warnings you can try this:
>>>>> http://eddymulyono.livejournal.com/65791.html
>>>> This is supressing stdout, not warnings only!! :(
>>>
>>> Suppress stdout until the errors have passed, then restore it.
>> Did not get you, kindly put some more light on it
>
> Actually I just tried that, and webdriver seems to be ignoring the
> console redirect, it's still outputting to the console even when it
> shouldn't be.
>
> This doesn't work, although as far as I can see it should:
>
> _____________________________________________________
> orig_std_out = STDOUT.clone #Make a record of the default console output
> $stdout.reopen("Rubylog.txt", "w") #Create / overwrite logfile
> $stdout.sync = true #Allow interception of console output
> $stderr.reopen($stdout) #Pass errors to logfile
>
> require 'watir-webdriver'
> puts('goes to file')
>
> b = Watir::Browser.new #This generates a log from the driver
>
> # restore stdout
> $stdout = orig_std_out
> puts('goes to stdout')
> b.close
> _____________________________________________________
So basically we are taking warnings and redirecting it to some file 
instead of stdout??? Am I correct?

But this solution is not satisfying, isnt it possible to really solve 
warnings?

could you tell me the reason of these warnings?

Apart from webdriver's warning there are warnings related to facter and 
childprocess too.
I have no clue, where exactly am getting these warnings, its reason and 
its solutions.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.