You could put check in there to wait until the element exists<http://watirwebdriver.com/waiting/>. Generally if you run the exact same test twice regardless of the framework and the second time you get different results there is either something wrong with the setup or the environment. It could be a timing issue like you mentioned. I would probably take the code for the flow and put it in an example in the same spec where the example that uses the flow is and start my debugging there( I dont always use the debugger or irb, I tend to more often put in some "p element_I_want.exists?" and "p element_I_want.html" to figure out what is going on) they would both hit the exact same code(one the flow and the other the code that the flow uses) if one passes and one fails adding some checks (like exists?) and all that may give you an idea as to why it doesnt always find that element.
On Mon, Sep 26, 2011 at 4:23 AM, hillary <[email protected]> wrote: > I'm trying to be as specific as possible. I've also attached the index.html > for one of my test runs. But let me know what part of my code you need to > see. If it makes a difference, I'm really only using the browser.rb file > from this branch. I didn't want to complicate things, by trying to upgrade > both. > > My most common problem seems to be with clicking on links after navigating > to a new page. My issues seem to be: > > 1) This element: > element(:app_link) {browser.link(:href, > /ApplicationID=ResonanceRecords01/)}. I had also defined this element by > name, and id. It produces an "Element no longer valid" error. > > I use it in a flow, this flow is the first thing i call after logging into > the web app. > def go_to_rec_box_flow(params={}) > catalog_blacklist_page.rest > manage_recommendation_page.app_link.click > catalog_blacklist_page.rest > manage_recommendation_page.loc_link.when_present.click > end > > This might be a problem with one of my enviornments, but it also can't find > this element at times. So i get a timeout, even though it's logged in > successfully. This is my biggest block because I can't execute half of my > tests unless I can click on this link. Because of this two specs will fail > on this step, so I'm not sure what will be wrong with these specs after this > link issue gets fixed. > > 2) The "Element is no longer Valid" error > > This will happen for elements other than the one above. Most commonly it's > with links. > > 3) Inconsistency > I use a lot of flows, and for one test it'll pass but another time it will > fail. > > -- > 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] > -- 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]
