On Sep 22, 2009, at 1:16 PM, "Mohammad Azam" <azamsh...@gmail.com<mailto:azamsh...@gmail.com>> wrote:
Thanks for the answer! That does resolve the issue. I wonder how you found that ruby is calling the object version of the constructor and not the string one. Once I saw their code, your error msg made it clear that it was calling the object ctor. Plus, whenever a ruby object is passed to a method group that has object as a choice for an argument, it will select that overload. Also, how does IronRuby knows whether to call ie.Goto(string) or ie.Goto(Uri); By the type of object you give it :) Ruby has a type system, so at runtime it can figure out what method to call based on the argument provided. Thanks, Azam On Tue, Sep 22, 2009 at 2:42 PM, Jimmy Schementi <<mailto:jimmy.scheme...@microsoft.com>jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>> wrote: Taking a look at the WatiN::Core::IE overloaded constructors, you can immediately see the issue: public IE(bool createInNewProcess); public IE(object iwebBrowser2); public IE(string url); public IE(Uri uri); When calling IE.new('<http://google.com>http://google.com'), the string is a Ruby string, which is resolving to the object overload rather than the string overload. A work-around currently will be to force the string to be a CLR string: IE.new('<http://google.com>http://google.com'.to_clr_string) However, it's unfortunate that IronRuby's CLR overload resolution is picking the more conservative choice, rather than seeing if the Ruby string can be coerced into a more specific overload. JD, have you found this while testing? Tomas, any specific reason this is the behavior, or would you call it a bug? I'd vote it as a bug. This will also work: ie = IE.new ie.go_to '<http://google.com>http://google.com' Here's the C# example ported to IronRuby: require 'Interop.SHDocVw' require 'WatiN.Core' include WatiN::Core ie = IE.new ie.go_to '<http://localhost:1879/Login.aspx>http://localhost:1879/Login.aspx' ie.text_field('txtUserName').type_text('azamsharp') I also verified this works from the interactive prompt, so you can use WatiN to control the browser interactively from IronRuby. ~Jimmy ________________________________ From: <mailto:ironruby-core-boun...@rubyforge.org> ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [<mailto:ironruby-core-boun...@rubyforge.org>ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] on behalf of Jimmy Schementi [<mailto:jimmy.scheme...@microsoft.com>jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>] Sent: Tuesday, September 22, 2009 11:39 AM To: <mailto:ironruby-core@rubyforge.org> ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Subject: Re: [Ironruby-core] IronRuby with WatiN By "C# code" i meant the equivalent C# program that you said worked: <mailto:azamsh...@gmail.com>azamsh...@gmail.com<mailto:azamsh...@gmail.com> wrote: > I created a C# application and used WatiN. It worked flawlessly and without > any configuration Really I'd like to see your full C# project to see what is missing in the Ruby script. Otherwise, I'll just go to watin's website myself and try it out, but I can't guarantee I'll get back to you soon. I know finding bugs is frustrating, but providing as much information as possible, including a runnable self-contained repro, will help us reproduce the issue and get back to you with a fix. Otherwise we're just wasting time. For future reference, here's the info asked for when reporting bugs: <http://ironruby.codeplex.com/Wiki/View.aspx?title=Project%20Documentation&referringTitle=Home> http://ironruby.codeplex.com/Wiki/View.aspx?title=Project%20Documentation&referringTitle=Home ~js ________________________________ From: <mailto:ironruby-core-boun...@rubyforge.org> ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [<mailto:ironruby-core-boun...@rubyforge.org>ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] on behalf of Mohammad Azam [<mailto:azamsh...@gmail.com>azamsh...@gmail.com<mailto:azamsh...@gmail.com>] Sent: Tuesday, September 22, 2009 11:07 AM To: <mailto:ironruby-core@rubyforge.org> ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Subject: Re: [Ironruby-core] IronRuby with WatiN Here are the contents of ironrubywatin.rb file: require 'WatiN.Core.dll' require 'Interop.SHDocVw.dll' IE = WatiN::Core::IE i = IE.new('<http://localhost:1879/Login.aspx>http://localhost:1879/Login.aspx') There is no C# file. I run using: ir.exe ironrubywatin.rb Everything is placed in the bin/Debug folder hence no path reference is required! Thanks, Azam On Tue, Sep 22, 2009 at 10:56 AM, Jimmy Schementi <<mailto:jimmy.scheme...@microsoft.com>jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>> wrote: Azam, without seeing the contents of ironrubywatin.rb, or what a correct C# WatiN program looks like ... we can't help much. So, either send the Ruby and C# source so we can compare, or can you package up your testing directory into a zip file and host it somewhere online so we can try it ourselves? Please don't attach it to this thread, as the mailing list will regect a large attachment. ~js ________________________________ From: <mailto:ironruby-core-boun...@rubyforge.org> ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [<mailto:ironruby-core-boun...@rubyforge.org>ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] on behalf of Mohammad Azam [<mailto:azamsh...@gmail.com>azamsh...@gmail.com<mailto:azamsh...@gmail.com>] Sent: Tuesday, September 22, 2009 10:40 AM To: <mailto:ironruby-core@rubyforge.org> ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Subject: Re: [Ironruby-core] IronRuby with WatiN Hi, I tried it and it did not work. Here are the details: C:\Projects\ILoveIronRuby\ILoveIronRuby\testing\bin\Debug>ir ironrubywatin.rb ironrubywatin.rb:8: iwebBrowser2 needs to implement shdocvw.IWebBrowser2 (Argume ntError) Thanks, Azam On Tue, Sep 22, 2009 at 10:10 AM, Shri Borde <<mailto:shri.bo...@microsoft.com>shri.bo...@microsoft.com<mailto:shri.bo...@microsoft.com>> wrote: IronRuby start the main thread in STA mode as can be seen by this command: c:\>rbx -e "puts System::Threading::Thread.CurrentThread.ApartmentState" STA However, new threads are created in MTA mode (the default). c:\>rbx -e "Thread.new{ puts System::Threading::Thread.CurrentThread.ApartmentState }.join" MTA I doubt this is the problem as the error messages would be something else. For C#, are all dlls next to the C# application exe? Try running the IronRuby repro out of bin\Debug to reduce the issues that could cause problems. If you cannot get even “require ‘Microsoft.mshtml.dll’” to work, then you know its some basic problem unrelated to Watin. From: <mailto:ironruby-core-boun...@rubyforge.org> ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [mailto:<mailto:ironruby-core-boun...@rubyforge.org>ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] On Behalf Of Mohammad Azam Sent: Monday, September 21, 2009 7:07 PM To: <mailto:ironruby-core@rubyforge.org> ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Subject: Re: [Ironruby-core] IronRuby with WatiN WatiN works in STA (Single Threaded Apartment). Maybe I am missing that? How can I create STA threads in IronRuby. On Mon, Sep 21, 2009 at 7:03 PM, Mohammad Azam <<mailto:azamsh...@gmail.com>azamsh...@gmail.com<mailto:azamsh...@gmail.com>> wrote: I created a C# application and used WatiN. It worked flawlessly and without any configuration. For some reason IronRuby is requiring something more to run the application. On Mon, Sep 21, 2009 at 3:11 PM, Jimmy Schementi <<mailto:jimmy.scheme...@microsoft.com>jimmy.scheme...@microsoft.com<mailto:jimmy.scheme...@microsoft.com>> wrote: You can do "igem install" against any pure-Ruby gem; only gems with native extensions require an IronRuby-specific gem. And "igem" is nothing more than a bat file to call RubyGems with IronRuby; RubyGems for IronRuby is identical to MRI's version. That being said, I don't know what type of dependencies Selenium has. From: <mailto:ironruby-core-boun...@rubyforge.org> ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> [mailto:<mailto:ironruby-core-boun...@rubyforge.org>ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>] On Behalf Of Mohammad Azam Sent: Monday, September 21, 2009 3:03 PM To: <mailto:ironruby-core@rubyforge.org> ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Subject: Re: [Ironruby-core] IronRuby with WatiN I will try the Selenium Client gem. But is there any igem install selenium-client or do I have to use the Ruby version of Selenium client. On Mon, Sep 21, 2009 at 2:52 PM, Ivan Porto Carrero <<mailto:i...@flanders.co.nz>i...@flanders.co.nz<mailto:i...@flanders.co.nz>> wrote: You could try the selenium client gem that may work. --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: <http://flanders.co.nz> http://flanders.co.nz Twitter: <http://twitter.com/casualjim> http://twitter.com/casualjim Author of IronRuby in Action (<http://manning.com/carrero>http://manning.com/carrero) On Mon, Sep 21, 2009 at 11:35 PM, Mohammad Azam <<mailto:azamsh...@gmail.com>azamsh...@gmail.com<mailto:azamsh...@gmail.com>> wrote: Hi, Since, Watir is currently not supported I want to check out WatiN with IronRuby. Yes, I know I can use it with C# but I am interested in using IronRuby. I am getting the following exception: Here is the code: require File.dirname(__FILE__) + '/bin/Debug/WatiN.Core.dll' require File.dirname(__FILE__) + '/bin/Debug/Interop.SHDocVw.dll' require File.dirname(__FILE__) + '/bin/Debug/Microsoft.mshtml.dll' IE = WatiN::Core::IE i = IE.new() -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list <mailto:Ironruby-core@rubyforge.org>Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> <http://rubyforge.org/mailman/listinfo/ironruby-core>http://rubyforge.org/mailman/listinfo/ironruby-core -- Mohammad Azam MVP (Microsoft Valuable Professional) <http://www.highoncoding.com>www.highoncoding.com<http://www.highoncoding.com> <http://www.azamsharp.com>www.azamsharp.com<http://www.azamsharp.com> _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core