Personally, I would be happy with just a parent() method. I.e, if you
have a page element identified, just:
parent(element)
One can always do parent.class to find out what it is. Or something
roughly like this might be useful:
parent_info = identify_parent(element) [This would return
id, name, class...]
Lonny Eachus
==========
(...)
I would appreciate comments on how intuitive you find the following
possible syntaxes. I also would appreciate hearing other suggestions.
table = $ie.frame('frame1').table(:containing, span)
table = span.parent.table(:index, 1)
It also seems that we need to support the case where you want to know
the containing element (say Div) of a particular class, so this is also
something to consider.
Some of these may be easier than others to implement, but right now i
am trying to figure out what would be an intuitive Watir-like syntax
for this kind of thing.
Bret
It is 1-based
ie.textField(:index, 1).set("I did it!")
--Mark
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Nathan
Sent: Wednesday, November 15, 2006 12:28 PM
To: [email protected]
Subject: Re: [Wtr-general] Find parent table index from a specific
elementwithin
So if I understand correctly, you have a table that looks something like
the following:
[code]
<table border=1>
<tr>
<td>...</td>
<td><span>findme</span></td>
<td><input type=text value=""></input></td>
<td>...</td>
</tr>
</table>
[/code]
And you want to located the text field and enter some value into it?
Well you could do the following: Assuming that this text field is the
first and only text field on the page, then some like this code would be
able to access it and enter the value "I did it!" into that text field:
ie.textField(:index, "0").set("I did it!")
Does that make sense or am I way off?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5270&messageID=14675#14675
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
Okay, that's no good. Is your web page available online somewhere so that I might give it a go and try to do what you are trying to do? As far as the image method goes, if there isn't an image that represents your menu, then don't use the image, for example if your menu is a link, use link instead of image. Watir can only work with objects that are actually on your webpage - if no images, then Watir cannot see an image, which is what the message indicates. Watir can however do it! Because Watir uses the same technique as every other automated test tool for Internet Explorer, if Watir can't do it, then no other tool can, but I guarantee that Watir can do it.
So the reason why you see "Client SearchReportsBank TransferProceduresChange PasswordAdvantageCheck RequestsBonus AwardsPredictive Dialer" INSTEAD of Client Search Reports Bank.. etc. with spaces in between each word is likely because in your webpage there aren't spaces after each word. If in your webpage you were to place a space after each word, probably in the form then you would also see spaces between each word when you do $ie.text. Let's try something different. Open up a command line window (if you don't already know how, click on the Start button, click on Run, enter cmd, then click OK). From there type irb and press Enter. This brings you into the Ruby console. Now type the following, pressing enter after each line - case matters remember, and you should never see the word nil unless I tell you:
require 'watir'
include Watir
$ie=IE.start([i]type the URL to your webpage here in quotation marks[/i])
$ie.show_links
This will list all of the attributes of all of the links on your website. Try it out and let me know what you get. To exit the Ruby console type exit and press Enter.
Nathan
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5259&messageID=14686#14686
Hey Nathan,
the result I get from $ie.show_links [br]
irb(main):008:0> $ie.show_links
index name id href
text/src
="" nil
[br]
Somehow, I have made it work now. Even though the source code doesn't show any tags or divs, the links are actually showing as divs. I installed IE developers toolbar & using that, I found that those links are showing as a div & my developer said that the js file in within a div or something.. but bottom line.. using a div as[br]
$ie.div(:index, 2).click[br]
I am able to click on the link.
The only problem is, if the developer change the order, I have to find the index number again. When I do [code]
$ie.divs.each {|d|
puts d.to_s
puts " " }
[/code]
I get [CODE SNIPPET]
type: Div
id:
name:
value:
disabled:
style:
text: Client Search
[/CODE SNIPPET]
since div only recognize id, name or index.. I can't use text so have to use :index in this case.
Thanks for all the help
Prashant
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5259&messageID=14688#14688
Even though the links are in _javascript_ file, installing IE developer toolbar showed those links are divs & then using divs, able to click on the links
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5259&messageID=14689#14689
I get only "there are 6 frames" when executing ie.show_frames.
So I think it must be of the watir version that causes my problem.
I am very sorry, and thanks to you all
1. First of all do:
ie.show_frames
List will give you a list of frames.
2. Then for each of the frame names returned in step 1 do:
ie.frame("<the_name_of_a_frame>").show_images
This will give you lists of images in each frame (you have to replace
<the_name_of_a_frame> with the actual name of a frame returned in step
1. If there are 5 frames returned in step 1, then you might have to
do step 2 five times to find out which frame contains your image.
3. Once you know the name of the frame that contains the image (let's
say it is called "frame5") do:
ie.frame("frame5").image(:src, /logout/).flash
Cheers,
Daniel.
On 15/11/06, Nie Guoqiang <[EMAIL PROTECTED]> wrote:
Thanks for your reply!
I tyied with ie.show_frames.frame("logo").show_images , but get such msg as "undefined method for 0..5:Range"
BTW: how can i access one specified frame, eg. MENU?
ie.frame("MENU") doesnot work.
Frame codes is as below:
++++++++++++++++++++++++++++++++++
<frameset rows="80,*,20" cols="*" frameborder="NO" border="0" framespacing="0">
<frameset rows="54,26" frameborder="NO" border="0" framespacing="0">
<frame name="logo" src="" scrolling="no"/>
<frame name="TITLE" src="" scrolling="no"/>
</frameset>
<frameset cols="210,*" frameborder="NO" border="0" framespacing="0">
<frame name="MENU" src="" scrolling="auto"/>
<frame name="ACTION" src="" scrolling="auto" />
</frameset>
<frameset cols="*,200" frameborder="NO" border="0" framespacing="0">
<frame name="alertnotice" src="" scrolling="no"/>
<frame name="TIMESTAMP" src="" scrolling="no"/>
</frameset>
</frameset>
++++++++++++++++++++++++++++++++++
Your HTML snippet didn't show that there where any frames. Find the
name of the frame that contains the image using e.g:
ie.show_frames.some_frame.show_images
If the image is listed for frame "show_frame" (frames will have
different names for you) then you could use:
ie.frame("some_frame").image(:src, /logout/).flash
Cheers,
Daniel.
On 15/11/06, Nie Guoqiang <[EMAIL PROTECTED]> wrote:
The codes doesnot work :(
More tips:
When I execute ie.show_frames(), I get "There is 6 frames".
And when ie.show_images() is executed, message is "0".
Thanks
On 11/14/06, Nie Guoqiang <[EMAIL PROTECTED]> wrote: how can i access this icon-button.
<img src="" />
Hi Nie,
This will click logout image:
ie.image(:src, /logout/).flash
If this does not do what you need, let me know.
沤eljko
--
http://zeljkofilipin.com/
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Nie Guoqiang NEC-CAS Software Department 1K/4SG
Tel : 010-82334433-356 / 8-0086-22-356
Email : [EMAIL PROTECTED]
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Nie Guoqiang NEC-CAS Software Department 1K/4SG
Tel : 010-82334433-356 / 8-0086-22-356
Email : [EMAIL PROTECTED]
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Nie Guoqiang NEC-CAS Software Department 1K/4SG
Tel : 010-82334433-356 / 8-0086-22-356
Email : [EMAIL PROTECTED]
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
the reason I had it on the ie object is that it comes fromthe user
Agent, so it only applies to the ie object. I do think that some other
approach might be more meaningful though, for example
Watir::Utils::Environment::OS => "vista"
Im sure there must be a win api call that gets this stuff, rather than
using the userAgent
Its in Jira, WTR-116
Paul
----- Original Message ----- From: "Charley Baker"
<[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, November 15, 2006 12:51 PM
Subject: Re: [Wtr-general] detecting versions of browser and os
Paul,
I'm not currently testing with IE 7 but most likely will be soon,
particularly since the upgrade is part of the system updates which
means the user base will expand quickly. Can you add a JIRA task for
this?
While the browser version makes sense in context of the ie object,
the os version and language don't. They'd make more sense to me in the
context of the Watir module, possibly in their own class, Environment?
Other thoughts?
-Charley
On 11/11/06, Paul Rogers <[EMAIL PROTECTED]> wrote:
I think, now that we have vista, ie7 etc, that the following would be
useful:
ie.browser_version => "IE7"
ie.os => "XP"
ie.os_language =>"en-us"
etc
as Im sure, many people like me now either need to test multiple
browsers/os
or at least need to know what it was tested on.
I have most of the code, I just need to know if there are any comments
on
method names etc?
Paul
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
|