[wtr-general] Re: clicking on a link, with certain parameters changing every time
I wish unique ID or Name attribute could be added but it's not possible. So, I am still using index way. So far it's working fine, but I am still looking for a better solution. Thanks for responses :) On Mar 6, 2:30 am, SuperKevy kpe...@scholarshipamerica.org wrote: The thread about adding a unique ID or Name attribute to the link is a good one and provides a solid hook. Its the easiest and a perferred If thats not possible... you can get all the links (by index) then fingerprint the URL content of each for something you can reliably lock onto. For example, http://a3.alienaa.com/cgibin/ fish.fcgiemail=yobtuol...@hotmail.co.uk. that gives you the link and content to trigger you test from --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: clicking on a link, with certain parameters changing every time
I think you have a few potential solutions 1) talk to your developers about making this thing more testable, e.g. assign something like an ID or Name value to that link in the HTML, it won't be visable on the page, but it would make it easier to select the right link. I don't know your app, but potentially this could be a very simple change for the developers to make and could vastly increase the testability of the product. 2) don't get the link by index. You obviously have some idea what makes this the 'right' link, and it seems to center around the URL value. So figure out how to express the pattern of the 'right url' as a regular expression, and select the link by :URL using that regular expression. (watir devs, I'm not nuts right? that should work shouldn't it?) On Mar 4, 9:43 pm, Rasika rasika.bahiram...@gmail.com wrote: Thanks for rresponses I used ie.link(index,2).text to fetch the values value.split to use them in next step. But another issue, Index of link always changes, and there is no other attribute to identify this link. How can I make sure I am clicking on correct link every time? On Mar 5, 2:53 am, SuperKevy kpe...@scholarshipamerica.org wrote: You want the URL I'm assuming.. then parse that for the info at the end ---Sample of Google. Whats the URL to the Privacy link -- require 'watir' include Watir ie. = IE.new ie.goto('http://www.google.com') puts ie.link(:text,'Privacy').attribute_value('href')- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: clicking on a link, with certain parameters changing every time
you need to use ruby string functions to get to this. in this case for example you could (assuming your url is in a variable called foo), use foo.slice(foo.length-3,3). this would return 4,5. you can split this off a comma delimiter and get back [4] and [5]. - test.split',' this will not work for example if you have more than single digits. for that you will have to know a little more about the urls you are dealing with. assuming you have these urls you are testing with. you can use index to get the position of that last value and then use slice above to get the digits. this should give you a starting point. you will have to brush up on ruby string functions though. On Mar 4, 7:23 am, Rasika rasika.bahiram...@gmail.com wrote: Hi All, The web page I am accessing has all links as 'href', no name, no id. Most of the links I can access by text But there is a specific link, where text as well as certain parameters in href also change right now I can access it with index, but that is also subject to change. below is the link, http://a3.alienaa.com/cgibin/fish.fcgiemail=yobtuol...@hotmail.co.ukpass=step=load2row=4col=5hooks=lhookrod=logbbait=doughloc=oceanwanting=fking4,5 now the issue is, I have to grab, numbers (4,5) at the end of the link and us them at next page. How do I do that? looking for a helpful response. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: clicking on a link, with certain parameters changing every time
Thanks for rresponses I used ie.link(index,2).text to fetch the values value.split to use them in next step. But another issue, Index of link always changes, and there is no other attribute to identify this link. How can I make sure I am clicking on correct link every time? On Mar 5, 2:53 am, SuperKevy kpe...@scholarshipamerica.org wrote: You want the URL I'm assuming.. then parse that for the info at the end ---Sample of Google. Whats the URL to the Privacy link -- require 'watir' include Watir ie. = IE.new ie.goto('http://www.google.com') puts ie.link(:text,'Privacy').attribute_value('href') --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---