Re: [Wtr-general] cell access
Span and theIndex are good for locating items. In order to construct a loop and access all items, how does one find out the number of items in a span element? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4509messageID=13072#13072 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] cell access
Hi,Using latest version of watir you can access span element using:$ie.span(:class, TblHdrTxt)for accessing TH you can use xpath query for getting the element.Regards, AngrezOn 9/22/06, Luke [EMAIL PROTECTED] wrote: Sorry for asking but I can't deal with it, I've got a table on page and I want to get to the cell Action can someone show me how to do it,I can't firgure out and fail all the time table id=form1:ReportUnit:tblDetails style=font-size: 11px;width: 640px class=Tbl border =0 cellpadding=0 cellspacing=0caption id=form1:ReportUnit:tblDetails:_titleBar class=TblTtlTxtDetail /captiontr id=form1:ReportUnit:tblDetails:tableRowGroupS:_columnHeaderBar:0th id =form1:ReportUnit:tblDetails:tableRowGroupS:colLinkS:_columnHeader class=TblColHdr align=center scope= colspan class=TblHdrTxtAction/span/th... ___Wtr-general mailing listWtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] cell access
I don't think Watir (1.4.1, at least) has built-in support for the th tag. But if you know the index of that span in the document, you can get to it using $ie.span(:index, theIndex) Otherwise, if you really need to interact with the TH itself, you may need to use Watir 1.5.x and its new XPath support (unless 1.5 already has a class for TH). The list archives have examples of using XPath to access unsupported elements. On 9/22/06, Luke [EMAIL PROTECTED] wrote: Sorry for asking but I can't deal with it, I've got a table on page and I want to get to the cell Action can someone show me how to do it, I can't firgure out and fail all the time table id=form1:ReportUnit:tblDetails style=font-size: 11px;width: 640px class=Tbl border=0 cellpadding=0 cellspacing=0 caption id=form1:ReportUnit:tblDetails:_titleBar class=TblTtlTxtDetail /caption tr id=form1:ReportUnit:tblDetails:tableRowGroupS:_columnHeaderBar:0 th id=form1:ReportUnit:tblDetails:tableRowGroupS:colLinkS:_columnHeader class=TblColHdr align=center scope= colspan class=TblHdrTxtAction/span/ th ... ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] cell access
Umm.. I have no idea what you're talking about, Bill. th is just a td with some fancy formatting. I see no reason why a command like the following wouldn't work with Watir 1.4.1:irb ie.table(:index, 1)[1][3].flash As with anything you do, there are usually a few ways to get to a particular object on a page. You could just try to use the table(..)[row#][col#].whatever approach, or you could try to just access the span tag directly (as you suggested) and completely ignore the table. Luke, in order for us to know what kind of advice to offer, it might help for you to also tell us what you have tried. Including the section of html was good, but not enough. Is the table in a frame? Is the Action just a text label, or also a link? Trying to get to something is not always straightforward by zooming in on the target. Sometimes you have to step back and take in the big picture too. Paul C.On 22/09/06, Bill Agee [EMAIL PROTECTED] wrote: I don't think Watir (1.4.1, at least) has built-in support for the th tag.But if you know the index of that span in the document, you can getto it using $ie.span(:index, theIndex)Otherwise, if you really need to interact with the TH itself, you may need to use Watir 1.5.x and its new XPath support (unless 1.5 alreadyhas a class for TH).The list archives have examples of using XPathto access unsupported elements. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] cell access
Ah, yes. It's been so long since I looked at any table code I forgot that the easiest way is to get cells is to use table.[index][index]. That does indeed work fine with the th tags in Luke's HTML snippet. By support I meant that there is no TableHeader class in Watir, but accessing table headers works fine without one. :) On 9/23/06, Paul Carvalho [EMAIL PROTECTED] wrote: Umm.. I have no idea what you're talking about, Bill. th is just a td with some fancy formatting. I see no reason why a command like the following wouldn't work with Watir 1.4.1: irb ie.table(:index, 1)[1][3].flash As with anything you do, there are usually a few ways to get to a particular object on a page. You could just try to use the table(..)[row#][col#].whatever approach, or you could try to just access the span tag directly (as you suggested) and completely ignore the table. Luke, in order for us to know what kind of advice to offer, it might help for you to also tell us what you have tried. Including the section of html was good, but not enough. Is the table in a frame? Is the Action just a text label, or also a link? Trying to get to something is not always straightforward by zooming in on the target. Sometimes you have to step back and take in the big picture too. Paul C. On 22/09/06, Bill Agee [EMAIL PROTECTED] wrote: I don't think Watir (1.4.1, at least) has built-in support for the th tag. But if you know the index of that span in the document, you can get to it using $ie.span(:index, theIndex) Otherwise, if you really need to interact with the TH itself, you may need to use Watir 1.5.x and its new XPath support (unless 1.5 already has a class for TH). The list archives have examples of using XPath to access unsupported elements. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] cell access
Sorry for asking but I can't deal with it, I've got a table on page and I want to get to the cell Action can someone show me how to do it,I can't firgure out and fail all the time table id=form1:ReportUnit:tblDetails style=font-size: 11px;width: 640px class=Tbl border=0 cellpadding=0 cellspacing=0caption id=form1:ReportUnit:tblDetails:_titleBar class=TblTtlTxtDetail /captiontr id=form1:ReportUnit:tblDetails:tableRowGroupS:_columnHeaderBar:0 th id=form1:ReportUnit:tblDetails:tableRowGroupS:colLinkS:_columnHeader class=TblColHdr align=center scope= colspan class=TblHdrTxtAction/span/ th... ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general