Hi Chuck, You are right in regards to the length of the id's used in identification. Also there is lot of dynamic data. short description should be beneficial. I will fix my script.
I ran my script in IRB, and found that .click is returning back a value(time it took to execute), but I don't see any change in my screen. Then I started using fire_events and got partial success with onmousedown(highlights my email). Wondered if another fire_event can trigger a 'enter'on that highlighted email. Thanks On Oct 14, 9:01 am, Chuck van der Linden <[email protected]> wrote: > Keeping in mind what Cliff and Orde both say below, if you need to > push forward I might suggest a few things > > first, are you sure you need to fire the event against the 'subj' > div? The name of the class for the div above that makes me think it > would be the one with the resize functionality attached to it, and any > click within that area is what might be needed. > > Second, you're a really long chain there, and a bunch of it is almost > certainly not needed in order to identify the element you are after. > ID's should be unique on a page, so any time you are locating a chain > like that, mostly by ID, you can generally omit the higher level > items. This isn't like xpath where you need to specify the entire > path to the element, you just need enough info to uniquely identify an > element, and outer containers are really not needed unless that's > where you can make that identification (e.g. the inner item has no > unique properties) > > This: > @browser.div(:id,"shellcontent").div(:id,"inboxcontainer").div(:id,"msg- > list").div(:class,"list-view ").div(:class,"list-view-items > ").div(:class=>"list-view-item btn-msglist resize- > columns", :index=>1).div(:class,"subj").fire_event('onmousedown') > > Could be shortened to at the very least this > @browser.div(:id,"msg-list").div(:class,"list-view ").div(:class,"list- > view-items > ").div(:class=>"list-view-item btn-msglist resize- > columns", :index=>1).div(:class,"subj").fire_event('onmousedown') > > And even more likely down to this: > @browser.div(:class=>"list-view-item btn-msglist resize- > columns", :index=>1).div(:class,"subj").fire_event('onmousedown') > > Try using IRB along with .flash against the minimum you think you > need, to see if you can properly locate the element. This will make > the code a lot more readable, remove a lot of potential for typos, and > generally make the code a lot less brittle as a change to one of those > outer containers won't break your code. It may also make the code run > slightly faster. > > BTW if you are after a specific mail you expect to be on the page, it > might be easier to locate the div by the subject text, and then if > needed make use of .parent to work your way back to an outer container > for that row > > On Oct 13, 8:00 pm, Cliff Cyphers <[email protected]> wrote: > > > > > And if you are using the yahoo and gmail accounts for test purposes, > > pop them instead and much easier to automate with ruby('net/pop'). > > > On Thu, Oct 13, 2011 at 8:34 PM, orde <[email protected]> wrote: > > > I've seen this topic come up a few times in this forum (i.e. > > > automating yahoo email or gmail), and I'd advise finding another > > > option if possible. They have tons of dynamic content and change > > > frequently, so it's a serious challenge to maintain. > > > > Sorry it's not the answer that you're looking for, but that's my 2 > > > cents. > > > > HTH > > > > orde > > > > On Oct 13, 3:53 pm, iamqa <[email protected]> wrote: > > >> I am trying to automate some testing on yahoo email. I need to click > > >> on the subject or from, so that the email content opens up. I am able > > >> to select the first email by firing onmousedown but unable to go > > >> forward from there. > > >> This is my code: > > > >> @browser.div(:id,"shellcontent").div(:id,"inboxcontainer").div(:id,"msg- > > >> list").div(:class,"list-view ").div(:class,"list-view-items > > >> ").div(:class=>"list-view-item btn-msglist resize- > > >> columns", :index=>1).div(:class,"subj").fire_event('onmousedown') > > > >> I tried firing onkeyup, onkeydown, onmouseup, onmousedown, onclick but > > >> nothing is working. I also tried send_keys("{ENTER}") but was getting > > >> an error as: > > > >> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/element.rb: > > >> 378:in `method_missing': undefined method `send_keys' for #<Watir::Div: > > >> 0x2b58d78 located=false how=:class what="subj"> (NoMethodError) > > >> from email_Agent_MonthlyNonMemberContent_Yahoo.rb:84 > > > >> Thanks > > > > -- > > > Before posting, please readhttp://watir.com/support. In short: search > > > before you ask, be nice. > > > > [email protected] > > >http://groups.google.com/group/watir-general > > > [email protected] -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
