• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JWebUnit clickLinkWithText

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there

I'm really hoping that someone can help me out. I've looked on the net and not found an answer yet.

Two questions:

Firstly, I want to find out if there is a way to click a link when all that is unique about the link is the url.

For example, there is a table with one column that has these delete hyperlinks as shown in this code here.



(I had to spell onclick wrong here to get this message to post)

Each link in the table is identical except for the sp=l1 parameter. The l1 is replaced by the number of the item. And I need to click on one specific item (this number l1) which is unique only by the href. Is there any way for me to do this?

Then second question, as you can see, when they click the link a confirm dialog pops up. Is there any way to get hold of that dialog and the buttons on it? I've tried using HttpUnitDialog but it just doesn't seem to be the right thing.

Many kind regards,
Rachel
[ February 23, 2006: Message edited by: Rachel Swailes ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer your first question, yes, it's possible by first asking for the HttpUnitDialog, then asking the HttpUnitDialog for the WebResponse, then asking the WebResponse for all WebLinks on the page, and then "manually" looping through each WebLink, comparing its getURLString() with what you're looking for. Once you've found the correct WebLink, call click() on it.
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Awesome. That solution works well! Thanks!

If there's anyone who can help me with the second part it would still be greatly appreciated.

Cheers,
Rachel
 
Why is the word "abbreviation" so long? And this ad is so short?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic