[wtr-general] Re: Can't send data by clicking link in another page

2011-06-16 Thread madh
I've found solution to this, turns out the problem wasn't on the link
on the second browser, but on the button on the first browser.

If I use
$browser.button(:id,"Button1").click
or
$browser.button(:href,/abc/).click

the issue will occurs, can't send the link text in the second browser
to the first browser.

But if I use the complete href
$browser.button(:href,"javascript:abc").click
the issue will be solved

On Jun 17, 9:01 am, madh  wrote:
> yes Rahul, thank you, i've managed to click the link, but the text
> field in the first browser is still empty. I guess is it something to
> do with the javascript or something else.
>
> I've tried debugging my code and make it stopped when it has opened
> the second browser, and then I use IRB to click on the link. Clicking
> it won't send the text to the first browser.
>
> But if I click the button in the first browser manually (I clicked the
> button using mouse), and then use IRB to click on the link in the
> second browser, the text will be send to the first browser. Kinda
> wondering what's the difference between opening it manually with using
> code.
>
> Code that I use to open the second browser is
> $browser.button(:id,"Button1").click -> the browser 2 will be opened
>
> code that i use to click the link in the second browser
> if window.table(:id,"ResultTable").link(:index,1).exist?
>           # Get the text of the link in the result table
>           result = window.table(:id,"ResultTable").link(:index,1).text
>           # Click the link
>           window.table(:id,"ResultTable").link(:index,1).click
> end
>
> have tried changing window.table(:id,"ResultTable").link(:index,
> 1).click to .fire_event "onClick" or  "onMouseOver" "onFocus"
> "onClick" but none are working
>
> On Jun 16, 7:30 pm, Rahul Sharma  wrote:
>
>
>
>
>
>
>
> > the correct syntax being
> > browser.window(:title => 'title).use do
>
> > On Jun 16, 11:31 am, Rahul Sharma  wrote:
>
> > > once you are on the first browser(page) try doing:
>
> > > @browser.use (:newBrowserPageTitle => 'title') do
>
> > > click link
>
> > > end
> > > check the text box is filled in the first browser(page
>
> > > On Jun 16, 10:33 am, madh  wrote:
>
> > > > sorry that the expanation is incomplete. The page 1 and page 2 are in
> > > > different browser. So clicking button in the page 1 will open another
> > > > browser.
>
> > > > On Jun 16, 5:28 pm, Rahul Sharma  wrote:
>
> > > > > Is the new page a page in the new browser, same browser?
>
> > > > > On Jun 16, 10:17 am, madh  wrote:
>
> > > > > > The text field in the page 1 is disabled, i've tried filling using
> > > > > > javascript but there's another issue coming up.
>
> > > > > > In the page one there is actually another field which is generated 
> > > > > > by
> > > > > > the selected link from the page 2.The ui in the page 1 looks like
> > > > > > below
>
> > > > > > Text field 1 (i.e store name) -> will be filled in by the link's 
> > > > > > text
> > > > > > from the page 2
> > > > > > Text field 2 (i.e location) -> will be generated depends on the
> > > > > > selected link in the page 2
> > > > > > button 1 -> to display the second page pop up, which is used to 
> > > > > > select
> > > > > > the store name.
>
> > > > > > I've tried
> > > > > > browser.fire_event "onClick" -> will only highlight the row
> > > > > > browser.link(:id, "abc").click -> will click the link in page 2 but
> > > > > > wont send the data to page 1
>
> > > > > > any idea to solve this?
>
> > > > > > thank you
>
> > > > > > On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
> > > > > > > Can you try capturing the text from the link on page 2 and set it 
> > > > > > > in
> > > > > > > the text field on page 1. If the text field on page 2  is non-
> > > > > > > editable, you can do that through Javascript
>
> > > > > > > On Jun 16, 9:27 am, madh  wrote:
>
> > > > > > > > HI,
>
> > > > > > > > I'm having difficulties with java script. I've one page (i.e 
> > > > > > > > page 1)
> > > > > > > > which has a text field and a button. Clicking on the button 
> > > > > > > > will open
> > > > > > > > another page (i.e page 2). In the page 2 there are one table, 
> > > > > > > > with one
> > > > > > > > link in each row. Clicking on the link will send the link text 
> > > > > > > > to the
> > > > > > > > text field in page 1.
> > > > > > > > the href of the link in the page 2 is:
>
> > > > > > > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > > > > > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > > > > > > I used IE to test this. But when I tried firebug in firefox, i 
> > > > > > > > found
> > > > > > > > the fire events were: mouse down, focus, mouse up and then 
> > > > > > > > click.
>
> > > > > > > > I've tried using those events but none working. Using On Click 
> > > > > > > > will
> > > > > > > > only highlight the row. I've used ie.link(:text, "abc").click, 
> > > > > > > > it will
> > > > > > > > click the link but won't send the abc to the field i

[wtr-general] Re: modal popups (sorry)

2011-06-16 Thread Hugh McGowan

Take a look at the title of the popup you're seeing. if it's not one
of

Message from webpage,
Windows Internet Explorer,
Microsoft Internet Explorer

then you can pass it in like this:
@browser.javascript_dialog(:title=>the_window_title_here).button('OK').click

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread madh
yes Rahul, thank you, i've managed to click the link, but the text
field in the first browser is still empty. I guess is it something to
do with the javascript or something else.

I've tried debugging my code and make it stopped when it has opened
the second browser, and then I use IRB to click on the link. Clicking
it won't send the text to the first browser.

But if I click the button in the first browser manually (I clicked the
button using mouse), and then use IRB to click on the link in the
second browser, the text will be send to the first browser. Kinda
wondering what's the difference between opening it manually with using
code.

Code that I use to open the second browser is
$browser.button(:id,"Button1").click -> the browser 2 will be opened

code that i use to click the link in the second browser
if window.table(:id,"ResultTable").link(:index,1).exist?
  # Get the text of the link in the result table
  result = window.table(:id,"ResultTable").link(:index,1).text
  # Click the link
  window.table(:id,"ResultTable").link(:index,1).click
end

have tried changing window.table(:id,"ResultTable").link(:index,
1).click to .fire_event "onClick" or  "onMouseOver" "onFocus"
"onClick" but none are working




On Jun 16, 7:30 pm, Rahul Sharma  wrote:
> the correct syntax being
> browser.window(:title => 'title).use do
>
> On Jun 16, 11:31 am, Rahul Sharma  wrote:
>
>
>
>
>
>
>
> > once you are on the first browser(page) try doing:
>
> > @browser.use (:newBrowserPageTitle => 'title') do
>
> > click link
>
> > end
> > check the text box is filled in the first browser(page
>
> > On Jun 16, 10:33 am, madh  wrote:
>
> > > sorry that the expanation is incomplete. The page 1 and page 2 are in
> > > different browser. So clicking button in the page 1 will open another
> > > browser.
>
> > > On Jun 16, 5:28 pm, Rahul Sharma  wrote:
>
> > > > Is the new page a page in the new browser, same browser?
>
> > > > On Jun 16, 10:17 am, madh  wrote:
>
> > > > > The text field in the page 1 is disabled, i've tried filling using
> > > > > javascript but there's another issue coming up.
>
> > > > > In the page one there is actually another field which is generated by
> > > > > the selected link from the page 2.The ui in the page 1 looks like
> > > > > below
>
> > > > > Text field 1 (i.e store name) -> will be filled in by the link's text
> > > > > from the page 2
> > > > > Text field 2 (i.e location) -> will be generated depends on the
> > > > > selected link in the page 2
> > > > > button 1 -> to display the second page pop up, which is used to select
> > > > > the store name.
>
> > > > > I've tried
> > > > > browser.fire_event "onClick" -> will only highlight the row
> > > > > browser.link(:id, "abc").click -> will click the link in page 2 but
> > > > > wont send the data to page 1
>
> > > > > any idea to solve this?
>
> > > > > thank you
>
> > > > > On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
> > > > > > Can you try capturing the text from the link on page 2 and set it in
> > > > > > the text field on page 1. If the text field on page 2  is non-
> > > > > > editable, you can do that through Javascript
>
> > > > > > On Jun 16, 9:27 am, madh  wrote:
>
> > > > > > > HI,
>
> > > > > > > I'm having difficulties with java script. I've one page (i.e page 
> > > > > > > 1)
> > > > > > > which has a text field and a button. Clicking on the button will 
> > > > > > > open
> > > > > > > another page (i.e page 2). In the page 2 there are one table, 
> > > > > > > with one
> > > > > > > link in each row. Clicking on the link will send the link text to 
> > > > > > > the
> > > > > > > text field in page 1.
> > > > > > > the href of the link in the page 2 is:
>
> > > > > > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > > > > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > > > > > I used IE to test this. But when I tried firebug in firefox, i 
> > > > > > > found
> > > > > > > the fire events were: mouse down, focus, mouse up and then click.
>
> > > > > > > I've tried using those events but none working. Using On Click 
> > > > > > > will
> > > > > > > only highlight the row. I've used ie.link(:text, "abc").click, it 
> > > > > > > will
> > > > > > > click the link but won't send the abc to the field in page one.
>
> > > > > > > Any idea on this issue?
>
> > > > > > > Thank you.

-- 
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: modal popups (sorry)

2011-06-16 Thread Anne
Thanks, Hugh

No more SEGV, but now I get...

C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/rautomation-0.5.1/lib/
rautomation/window.rb:220:in `wait_until_exists': Window with locator
{:title=>/^(Message from webpage|Windows Internet Explorer|Microsoft
Internet Explorer)$/} doesn't exist!
(RAutomation::UnknownWindowException)
from C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/rautomation-0.5.1/
lib/rautomation/window.rb:198:in `button'
from C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/watir-1.9.0/lib/
watir/dialogs/javascript.rb:15:in `button'
from ContactUsTests.rb:161

-- 
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: modal popups (sorry)

2011-06-16 Thread Hugh McGowan
The segmentation fault happens because you're on a version of watir
that doesn't support 1.8.7.

If you upgrade Watir to 1.9.0 you shouldn't get the SEGV. Also, in
1.9.0, WinClicker is no longer included but the dialogs are a lot
easier to deal with, eg:

if @browser.link(:text, "Print").exists?
@browser.link(:text, "Print").click_no_wait
@browser.javascript_dialog.button('Cancel').click
end #Close Popup

-- 
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] modal popups (sorry)

2011-06-16 Thread Anne
I'm trying to dismiss the print dialog that you see if you did File/
Print in IE.   (It's what our product brings up when you select the
print link on our web page.)

Here's the code snipit from my test script:
  if @browser.link(:text, "Print").exists?
@browser.link(:text, "Print").click_no_wait
# Print dialog opens
hwnd = @browser.enabled_popup(1)
w = WinClicker.new
w.makeWindowActive(hwnd)

 w.clickWindowsButton_hwnd(hwnd, "Cancel")

  end #Close Popup


before adding
require 'watir/contrib/enabled_popup'
I'd get "undefined module"
after adding it, I get
   C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.0/lib/watir/
winClicker.rb:305: [BUG] Segmentation fault
   ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]

   This application has requested the Runtime to terminate it in an
unusual way.
   Please contact the application's support team for more information.

I'm running
  IE 8 in Win XP
  Watir 1.8.0
  Ruby 1.8.7

I've tried using @browser.link(:text, "Print").click!
I've also tried @browser.modal_dialog(:title, "Print").close
and any other variation I've found going through all the popup threads

I know I must be missing something basic but I've run out of ideas and
the Segmentation fault hasn't helped.
I know this is 'yapp' (yet another popup problem), but can someone
point me in the right direction?

Thanks!
Anne

-- 
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: Need to click on a link which has only the class name.

2011-06-16 Thread orde
I'd agree with the post above.  Unless you have some other compelling
reason, the approach above should be fine.

In any event, $1 is returning nil in this code snippet:

if //
  begin
ie.link(:class, $1).click
  rescue => e
rescueHandle(e)
   end
else
   puts $1 # nil
   puts "FAILED! Could not find Class for Close Button"
   return false
end

On Jun 15, 12:30 pm, Chuck van der Linden  wrote:
> On Jun 15, 12:27 am, Mahesh  wrote:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> >  > id=mainTabsId__CaseDetails>
>
> > This is the source code, and i am using the if condition to extract
> > the dynamic class name to extract the class name & click the link.
>
> > The Watir script i am using is:
>
> > if //
> >                 begin
> >                         ie.link(:class, $1).click
> >                 rescue => e
> >                         rescueHandle(e)
> >                 end
> >         else
> >                 puts "FAILED! Could not find Class for Close Button"
> >                 return false
> >         end
>
> You say you are dynamically extracting the class of the link, does
> this mean it is changing in a regular basis?
>
> I'm having a hard time following exactly what your challenge is here,
> What do you know, e.g. what is constant each time or predictable each
> time?  how do you know you've found the link you want to click?
>
> If the pattern is for example a list item with a particular ID, that
> contains the link you want,  and the class of the link always contains
> the text "...strip-close" then you could do something like this
>
>  if browser.li(:id, mainTabsId__CaseDetails').link(:class, /strip-
> close/).exists?
>    browser.li(:id, mainTabsId__CaseDetails').link(:class, /strip-
> close/).click
>  else
>    puts "FAILED! Could not find Close Button"
>    return false
>  end

-- 
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: Need to access the login window

2011-06-16 Thread orde
This is more of a ruby question than a watir question.  I'd suggest
reading up on common control structures.  There is good documentation
at http://www.ruby-lang.org/en/documentation/ or (specific to your
question) 
http://www.howtogeek.com/howto/programming/ruby/ruby-if-else-if-command-syntax/




On Jun 16, 8:51 am, era gupta  wrote:
> This is what I want to know, How to use an If statement in this condition.
>
> On Thu, Jun 16, 2011 at 7:42 PM, Rahul Sharma 
> wrote:
>
>
>
>
>
>
>
> > After you have logged in you need to do  a check if login is prompted
> > again...use an "if" statement or something
>
> > On Jun 16, 2:13 pm, era gupta  wrote:
> > > Thanks Chuck for your response.
>
> > > Find below the code that I am trying to access:
>
> > > require 'watir'
> > > Watir::Browser.default = 'firefox'
> > > b = Watir::Browser.new
> > > b.goto ""
> > > b.link(:href, "").click
> > >         b.text_field(:id, "email_id").set("ad...@test.com")
> > >         b.text_field(:name, "pass").set("test")
> > >         b.link(:text, "Login").click
>
> > > In the above code line no. 6,7 and 8 I want to call when the site asks
> > for
> > > the login again. Otherwise it should go to some other task.
>
> > > Any Idea how it can be done.
>
> > > On Thu, Jun 16, 2011 at 2:32 AM, Chuck van der Linden  > >wrote:
>
> > > > On Jun 15, 5:12 am, Era  wrote:
> > > > > Hi,
>
> > > > > I am new in watir group and not very good in watir scripting. Please
> > > > > help me to write the script for the following scenario:
>
> > > > > There is one web application in which the user can access the main
> > > > > elements by logging into the account. But there is some issue in the
> > > > > login window. It sometimes asks to login twice it means the user has
> > > > > to give the username and password and then click on login button,
> > then
> > > > > again enter the same username and password and click on login window.
>
> > > > We're here to help, buy there is a limit, writing all the code for you
> > > > is past the limit.
> > > > What you can expect is responses in the area of helping when/where you
> > > > get stuck, and helping you refine your approach, or suggesting other
> > > > things to try instead.  With that in mind, please respond as best you
> > > > can tot he following:
>
> > > > Does your system always do this, or is there some random element which
> > > > controls when someone is asked for their credentials a second time?
>
> > > > Is there an easy way to tell (such as perhaps the page title) if the
> > > > user is still faced with a request for credentials verses logged into
> > > > the system?
>
> > > > Is the page source the same on both pages that request credentials?
>
> > > > Can you provide please a sample of the page's HTML and also most
> > > > important of all, the applicable Watir automation code you have tried
> > > > so far?
>
> > > > --
> > > > Before posting, please readhttp://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<
> >http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> > --
> > Before posting, please readhttp://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

-- 
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


Re: [wtr-general] Re: watir-webdriver & firebug

2011-06-16 Thread Jari Bakken
On Thu, Jun 16, 2011 at 4:15 PM, joedio  wrote:
> Jari ,
>
> Does this mean that when using webdriver:
>
> 1) If you start Firefox:
>          browser = Watir::Browser.new
>     that it runs with all addins disabled.
>
> 2) If you start Firefox:
>        browser = Watir::Browser.new(:firefox, :profile => "default")
>    it runs with your default addin settings
>
> 3) If you start Firefox::
>       myprofile = Selenium::WebDriver::Firefox::Profile.new
>       myprofile.add_extension("/path/to/addin.xpi")
>       browser = Watir::Browser.new(:firefox, :profile => myprofile)
>    it runs with only the specified addin enabled
>
> If so that would be good info to note in the RDoc.
>

That's right. I'm don't really want to add it to the docs as it would
mean duplicating docs for selenium-webdriver (where this functionality
lives). The watir-webdriver FAQ [1] links to the Selenium wiki page
[2] that explains this (among other things).

[1] https://github.com/jarib/watir-webdriver/wiki/FAQ
[2] http://code.google.com/p/selenium/wiki/RubyBindings

-- 
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


Re: [wtr-general] Re: Need to access the login window

2011-06-16 Thread era gupta
This is what I want to know, How to use an If statement in this condition.

On Thu, Jun 16, 2011 at 7:42 PM, Rahul Sharma wrote:

> After you have logged in you need to do  a check if login is prompted
> again...use an "if" statement or something
>
> On Jun 16, 2:13 pm, era gupta  wrote:
> > Thanks Chuck for your response.
> >
> > Find below the code that I am trying to access:
> >
> > require 'watir'
> > Watir::Browser.default = 'firefox'
> > b = Watir::Browser.new
> > b.goto ""
> > b.link(:href, "").click
> > b.text_field(:id, "email_id").set("ad...@test.com")
> > b.text_field(:name, "pass").set("test")
> > b.link(:text, "Login").click
> >
> > In the above code line no. 6,7 and 8 I want to call when the site asks
> for
> > the login again. Otherwise it should go to some other task.
> >
> > Any Idea how it can be done.
> >
> > On Thu, Jun 16, 2011 at 2:32 AM, Chuck van der Linden  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On Jun 15, 5:12 am, Era  wrote:
> > > > Hi,
> >
> > > > I am new in watir group and not very good in watir scripting. Please
> > > > help me to write the script for the following scenario:
> >
> > > > There is one web application in which the user can access the main
> > > > elements by logging into the account. But there is some issue in the
> > > > login window. It sometimes asks to login twice it means the user has
> > > > to give the username and password and then click on login button,
> then
> > > > again enter the same username and password and click on login window.
> >
> > > We're here to help, buy there is a limit, writing all the code for you
> > > is past the limit.
> > > What you can expect is responses in the area of helping when/where you
> > > get stuck, and helping you refine your approach, or suggesting other
> > > things to try instead.  With that in mind, please respond as best you
> > > can tot he following:
> >
> > > Does your system always do this, or is there some random element which
> > > controls when someone is asked for their credentials a second time?
> >
> > > Is there an easy way to tell (such as perhaps the page title) if the
> > > user is still faced with a request for credentials verses logged into
> > > the system?
> >
> > > Is the page source the same on both pages that request credentials?
> >
> > > Can you provide please a sample of the page's HTML and also most
> > > important of all, the applicable Watir automation code you have tried
> > > so far?
> >
> > > --
> > > Before posting, please readhttp://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<
> http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> --
> 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
>

-- 
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: Need to access the login window

2011-06-16 Thread Rahul Sharma
After you have logged in you need to do  a check if login is prompted
again...use an "if" statement or something

On Jun 16, 2:13 pm, era gupta  wrote:
> Thanks Chuck for your response.
>
> Find below the code that I am trying to access:
>
> require 'watir'
> Watir::Browser.default = 'firefox'
> b = Watir::Browser.new
> b.goto ""
> b.link(:href, "").click
>         b.text_field(:id, "email_id").set("ad...@test.com")
>         b.text_field(:name, "pass").set("test")
>         b.link(:text, "Login").click
>
> In the above code line no. 6,7 and 8 I want to call when the site asks for
> the login again. Otherwise it should go to some other task.
>
> Any Idea how it can be done.
>
> On Thu, Jun 16, 2011 at 2:32 AM, Chuck van der Linden wrote:
>
>
>
>
>
>
>
> > On Jun 15, 5:12 am, Era  wrote:
> > > Hi,
>
> > > I am new in watir group and not very good in watir scripting. Please
> > > help me to write the script for the following scenario:
>
> > > There is one web application in which the user can access the main
> > > elements by logging into the account. But there is some issue in the
> > > login window. It sometimes asks to login twice it means the user has
> > > to give the username and password and then click on login button, then
> > > again enter the same username and password and click on login window.
>
> > We're here to help, buy there is a limit, writing all the code for you
> > is past the limit.
> > What you can expect is responses in the area of helping when/where you
> > get stuck, and helping you refine your approach, or suggesting other
> > things to try instead.  With that in mind, please respond as best you
> > can tot he following:
>
> > Does your system always do this, or is there some random element which
> > controls when someone is asked for their credentials a second time?
>
> > Is there an easy way to tell (such as perhaps the page title) if the
> > user is still faced with a request for credentials verses logged into
> > the system?
>
> > Is the page source the same on both pages that request credentials?
>
> > Can you provide please a sample of the page's HTML and also most
> > important of all, the applicable Watir automation code you have tried
> > so far?
>
> > --
> > Before posting, please readhttp://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

-- 
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: watir-webdriver & firebug

2011-06-16 Thread joedio
Jari ,

Does this mean that when using webdriver:

1) If you start Firefox:
  browser = Watir::Browser.new
 that it runs with all addins disabled.

2) If you start Firefox:
browser = Watir::Browser.new(:firefox, :profile => "default")
it runs with your default addin settings

3) If you start Firefox::
   myprofile = Selenium::WebDriver::Firefox::Profile.new
   myprofile.add_extension("/path/to/addin.xpi")
   browser = Watir::Browser.new(:firefox, :profile => myprofile)
it runs with only the specified addin enabled

If so that would be good info to note in the RDoc.

Thanks,
Joe

-- 
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


Re: [wtr-general] Re: Need to access the login window

2011-06-16 Thread era gupta
Thanks Chuck for your response.

Find below the code that I am trying to access:

require 'watir'
Watir::Browser.default = 'firefox'
b = Watir::Browser.new
b.goto ""
b.link(:href, "").click
b.text_field(:id, "email_id").set("ad...@test.com")
b.text_field(:name, "pass").set("test")
b.link(:text, "Login").click

In the above code line no. 6,7 and 8 I want to call when the site asks for
the login again. Otherwise it should go to some other task.

Any Idea how it can be done.

On Thu, Jun 16, 2011 at 2:32 AM, Chuck van der Linden wrote:

> On Jun 15, 5:12 am, Era  wrote:
> > Hi,
> >
> > I am new in watir group and not very good in watir scripting. Please
> > help me to write the script for the following scenario:
> >
> > There is one web application in which the user can access the main
> > elements by logging into the account. But there is some issue in the
> > login window. It sometimes asks to login twice it means the user has
> > to give the username and password and then click on login button, then
> > again enter the same username and password and click on login window.
>
> We're here to help, buy there is a limit, writing all the code for you
> is past the limit.
> What you can expect is responses in the area of helping when/where you
> get stuck, and helping you refine your approach, or suggesting other
> things to try instead.  With that in mind, please respond as best you
> can tot he following:
>
> Does your system always do this, or is there some random element which
> controls when someone is asked for their credentials a second time?
>
> Is there an easy way to tell (such as perhaps the page title) if the
> user is still faced with a request for credentials verses logged into
> the system?
>
> Is the page source the same on both pages that request credentials?
>
> Can you provide please a sample of the page's HTML and also most
> important of all, the applicable Watir automation code you have tried
> so far?
>
> --
> 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
>

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread Rahul Sharma
the correct syntax being
browser.window(:title => 'title).use do

On Jun 16, 11:31 am, Rahul Sharma  wrote:
> once you are on the first browser(page) try doing:
>
> @browser.use (:newBrowserPageTitle => 'title') do
>
> click link
>
> end
> check the text box is filled in the first browser(page
>
> On Jun 16, 10:33 am, madh  wrote:
>
>
>
>
>
>
>
> > sorry that the expanation is incomplete. The page 1 and page 2 are in
> > different browser. So clicking button in the page 1 will open another
> > browser.
>
> > On Jun 16, 5:28 pm, Rahul Sharma  wrote:
>
> > > Is the new page a page in the new browser, same browser?
>
> > > On Jun 16, 10:17 am, madh  wrote:
>
> > > > The text field in the page 1 is disabled, i've tried filling using
> > > > javascript but there's another issue coming up.
>
> > > > In the page one there is actually another field which is generated by
> > > > the selected link from the page 2.The ui in the page 1 looks like
> > > > below
>
> > > > Text field 1 (i.e store name) -> will be filled in by the link's text
> > > > from the page 2
> > > > Text field 2 (i.e location) -> will be generated depends on the
> > > > selected link in the page 2
> > > > button 1 -> to display the second page pop up, which is used to select
> > > > the store name.
>
> > > > I've tried
> > > > browser.fire_event "onClick" -> will only highlight the row
> > > > browser.link(:id, "abc").click -> will click the link in page 2 but
> > > > wont send the data to page 1
>
> > > > any idea to solve this?
>
> > > > thank you
>
> > > > On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
> > > > > Can you try capturing the text from the link on page 2 and set it in
> > > > > the text field on page 1. If the text field on page 2  is non-
> > > > > editable, you can do that through Javascript
>
> > > > > On Jun 16, 9:27 am, madh  wrote:
>
> > > > > > HI,
>
> > > > > > I'm having difficulties with java script. I've one page (i.e page 1)
> > > > > > which has a text field and a button. Clicking on the button will 
> > > > > > open
> > > > > > another page (i.e page 2). In the page 2 there are one table, with 
> > > > > > one
> > > > > > link in each row. Clicking on the link will send the link text to 
> > > > > > the
> > > > > > text field in page 1.
> > > > > > the href of the link in the page 2 is:
>
> > > > > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > > > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > > > > I used IE to test this. But when I tried firebug in firefox, i found
> > > > > > the fire events were: mouse down, focus, mouse up and then click.
>
> > > > > > I've tried using those events but none working. Using On Click will
> > > > > > only highlight the row. I've used ie.link(:text, "abc").click, it 
> > > > > > will
> > > > > > click the link but won't send the abc to the field in page one.
>
> > > > > > Any idea on this issue?
>
> > > > > > Thank you.

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread Rahul Sharma
once you are on the first browser(page) try doing:

@browser.use (:newBrowserPageTitle => 'title') do

click link

end
check the text box is filled in the first browser(page

On Jun 16, 10:33 am, madh  wrote:
> sorry that the expanation is incomplete. The page 1 and page 2 are in
> different browser. So clicking button in the page 1 will open another
> browser.
>
> On Jun 16, 5:28 pm, Rahul Sharma  wrote:
>
>
>
>
>
>
>
> > Is the new page a page in the new browser, same browser?
>
> > On Jun 16, 10:17 am, madh  wrote:
>
> > > The text field in the page 1 is disabled, i've tried filling using
> > > javascript but there's another issue coming up.
>
> > > In the page one there is actually another field which is generated by
> > > the selected link from the page 2.The ui in the page 1 looks like
> > > below
>
> > > Text field 1 (i.e store name) -> will be filled in by the link's text
> > > from the page 2
> > > Text field 2 (i.e location) -> will be generated depends on the
> > > selected link in the page 2
> > > button 1 -> to display the second page pop up, which is used to select
> > > the store name.
>
> > > I've tried
> > > browser.fire_event "onClick" -> will only highlight the row
> > > browser.link(:id, "abc").click -> will click the link in page 2 but
> > > wont send the data to page 1
>
> > > any idea to solve this?
>
> > > thank you
>
> > > On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
> > > > Can you try capturing the text from the link on page 2 and set it in
> > > > the text field on page 1. If the text field on page 2  is non-
> > > > editable, you can do that through Javascript
>
> > > > On Jun 16, 9:27 am, madh  wrote:
>
> > > > > HI,
>
> > > > > I'm having difficulties with java script. I've one page (i.e page 1)
> > > > > which has a text field and a button. Clicking on the button will open
> > > > > another page (i.e page 2). In the page 2 there are one table, with one
> > > > > link in each row. Clicking on the link will send the link text to the
> > > > > text field in page 1.
> > > > > the href of the link in the page 2 is:
>
> > > > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > > > I used IE to test this. But when I tried firebug in firefox, i found
> > > > > the fire events were: mouse down, focus, mouse up and then click.
>
> > > > > I've tried using those events but none working. Using On Click will
> > > > > only highlight the row. I've used ie.link(:text, "abc").click, it will
> > > > > click the link but won't send the abc to the field in page one.
>
> > > > > Any idea on this issue?
>
> > > > > Thank you.

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread madh
sorry that the expanation is incomplete. The page 1 and page 2 are in
different browser. So clicking button in the page 1 will open another
browser.

On Jun 16, 5:28 pm, Rahul Sharma  wrote:
> Is the new page a page in the new browser, same browser?
>
> On Jun 16, 10:17 am, madh  wrote:
>
>
>
>
>
>
>
> > The text field in the page 1 is disabled, i've tried filling using
> > javascript but there's another issue coming up.
>
> > In the page one there is actually another field which is generated by
> > the selected link from the page 2.The ui in the page 1 looks like
> > below
>
> > Text field 1 (i.e store name) -> will be filled in by the link's text
> > from the page 2
> > Text field 2 (i.e location) -> will be generated depends on the
> > selected link in the page 2
> > button 1 -> to display the second page pop up, which is used to select
> > the store name.
>
> > I've tried
> > browser.fire_event "onClick" -> will only highlight the row
> > browser.link(:id, "abc").click -> will click the link in page 2 but
> > wont send the data to page 1
>
> > any idea to solve this?
>
> > thank you
>
> > On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
> > > Can you try capturing the text from the link on page 2 and set it in
> > > the text field on page 1. If the text field on page 2  is non-
> > > editable, you can do that through Javascript
>
> > > On Jun 16, 9:27 am, madh  wrote:
>
> > > > HI,
>
> > > > I'm having difficulties with java script. I've one page (i.e page 1)
> > > > which has a text field and a button. Clicking on the button will open
> > > > another page (i.e page 2). In the page 2 there are one table, with one
> > > > link in each row. Clicking on the link will send the link text to the
> > > > text field in page 1.
> > > > the href of the link in the page 2 is:
>
> > > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > > I used IE to test this. But when I tried firebug in firefox, i found
> > > > the fire events were: mouse down, focus, mouse up and then click.
>
> > > > I've tried using those events but none working. Using On Click will
> > > > only highlight the row. I've used ie.link(:text, "abc").click, it will
> > > > click the link but won't send the abc to the field in page one.
>
> > > > Any idea on this issue?
>
> > > > Thank you.

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread madh

The text field in the page 1 is disabled, i've tried filling using
javascript but there's another issue coming up.

In the page one there is actually another field which is generated by
the selected link from the page 2.The ui in the page 1 looks like
below

Text field 1 (i.e store name) -> will be filled in by the link's text
from the page 2
Text field 2 (i.e location) -> will be generated depends on the
selected link in the page 2
button 1 -> to display the second page pop up, which is used to select
the store name.

I've tried
browser.fire_event "onClick" -> will only highlight the row
browser.link(:id, "abc").click -> will click the link in page 2 but
wont send the data to page 1

any idea to solve this?

thank you


On Jun 16, 5:09 pm, Rahul Sharma  wrote:
> Can you try capturing the text from the link on page 2 and set it in
> the text field on page 1. If the text field on page 2  is non-
> editable, you can do that through Javascript
>
> On Jun 16, 9:27 am, madh  wrote:
>
>
>
>
>
>
>
> > HI,
>
> > I'm having difficulties with java script. I've one page (i.e page 1)
> > which has a text field and a button. Clicking on the button will open
> > another page (i.e page 2). In the page 2 there are one table, with one
> > link in each row. Clicking on the link will send the link text to the
> > text field in page 1.
> > the href of the link in the page 2 is:
>
> > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > I used IE to test this. But when I tried firebug in firefox, i found
> > the fire events were: mouse down, focus, mouse up and then click.
>
> > I've tried using those events but none working. Using On Click will
> > only highlight the row. I've used ie.link(:text, "abc").click, it will
> > click the link but won't send the abc to the field in page one.
>
> > Any idea on this issue?
>
> > Thank you.

-- 
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


Re: [wtr-general] Re: Jssh Socket error

2011-06-16 Thread Aditya
15 days back i invoked FF and i updated the watir version yesterday then it
was not working. Does it so? How do i resolve?  So plz help me in this.

 what is OP?

On Thu, Jun 16, 2011 at 2:39 AM, Chuck van der Linden wrote:

> On Jun 14, 3:02 am, V  wrote:
> > Hi , I am also facing the same issue.But in Windows.
> >
> > C:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.8.1/lib/firewatir/
> > jssh_socket.rb:19:in `js_eval':  this.docShell is null
> > (JsshSocket::JSTypeError)
> > from c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.8.1/lib/firewatir/
> > firefox.rb:194:in `set_browser_document'
> > from c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.8.1/lib/firewatir/
> > firefox.rb:104:in `goto'
> >
> > How do i resolve this. Earlier my Firefox was invoked automatically.
> > Now even i get this error i am still able to open firefox. But i am
> > not able to redirect the targeted url what i am looking for.
> >
> > Please let me know the solution for this.
> >
>
> Did you recently update your Ruby version as did the OP in this
> thread?  What if anything changed on the system between when it was
> working and now?
>
> --
> 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
>

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread Rahul Sharma
Is the new page a page in the new browser, same browser?

On Jun 16, 10:17 am, madh  wrote:
> The text field in the page 1 is disabled, i've tried filling using
> javascript but there's another issue coming up.
>
> In the page one there is actually another field which is generated by
> the selected link from the page 2.The ui in the page 1 looks like
> below
>
> Text field 1 (i.e store name) -> will be filled in by the link's text
> from the page 2
> Text field 2 (i.e location) -> will be generated depends on the
> selected link in the page 2
> button 1 -> to display the second page pop up, which is used to select
> the store name.
>
> I've tried
> browser.fire_event "onClick" -> will only highlight the row
> browser.link(:id, "abc").click -> will click the link in page 2 but
> wont send the data to page 1
>
> any idea to solve this?
>
> thank you
>
> On Jun 16, 5:09 pm, Rahul Sharma  wrote:
>
>
>
>
>
>
>
> > Can you try capturing the text from the link on page 2 and set it in
> > the text field on page 1. If the text field on page 2  is non-
> > editable, you can do that through Javascript
>
> > On Jun 16, 9:27 am, madh  wrote:
>
> > > HI,
>
> > > I'm having difficulties with java script. I've one page (i.e page 1)
> > > which has a text field and a button. Clicking on the button will open
> > > another page (i.e page 2). In the page 2 there are one table, with one
> > > link in each row. Clicking on the link will send the link text to the
> > > text field in page 1.
> > > the href of the link in the page 2 is:
>
> > > javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> > > Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> > > I used IE to test this. But when I tried firebug in firefox, i found
> > > the fire events were: mouse down, focus, mouse up and then click.
>
> > > I've tried using those events but none working. Using On Click will
> > > only highlight the row. I've used ie.link(:text, "abc").click, it will
> > > click the link but won't send the abc to the field in page one.
>
> > > Any idea on this issue?
>
> > > Thank you.

-- 
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: Can't send data by clicking link in another page

2011-06-16 Thread Rahul Sharma
Can you try capturing the text from the link on page 2 and set it in
the text field on page 1. If the text field on page 2  is non-
editable, you can do that through Javascript

On Jun 16, 9:27 am, madh  wrote:
> HI,
>
> I'm having difficulties with java script. I've one page (i.e page 1)
> which has a text field and a button. Clicking on the button will open
> another page (i.e page 2). In the page 2 there are one table, with one
> link in each row. Clicking on the link will send the link text to the
> text field in page 1.
> the href of the link in the page 2 is:
>
> javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
> Data:ResultTable.Data[ResultTable.CurrentIndex]})
>
> I used IE to test this. But when I tried firebug in firefox, i found
> the fire events were: mouse down, focus, mouse up and then click.
>
> I've tried using those events but none working. Using On Click will
> only highlight the row. I've used ie.link(:text, "abc").click, it will
> click the link but won't send the abc to the field in page one.
>
> Any idea on this issue?
>
> Thank you.

-- 
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] Can't send data by clicking link in another page

2011-06-16 Thread madh
HI,

I'm having difficulties with java script. I've one page (i.e page 1)
which has a text field and a button. Clicking on the button will open
another page (i.e page 2). In the page 2 there are one table, with one
link in each row. Clicking on the link will send the link text to the
text field in page 1.
the href of the link in the page 2 is:

javascript:window.opener.AssignValue({FieldId:"ABC",Key:"XYZ",
Data:ResultTable.Data[ResultTable.CurrentIndex]})

I used IE to test this. But when I tried firebug in firefox, i found
the fire events were: mouse down, focus, mouse up and then click.

I've tried using those events but none working. Using On Click will
only highlight the row. I've used ie.link(:text, "abc").click, it will
click the link but won't send the abc to the field in page one.

Any idea on this issue?

Thank you.

-- 
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