Share
View previous topicGo downView next topic
sumanpasupula
Posts : 2
Join date : 2011-04-12

Issue for clicking cancel button in a dialog box

on Thu Sep 29, 2011 8:19 pm
in webdriver, am unable to click the cancel button when a new dialog box appears...
can anyone suggest me ...

thanks in advance,
Suman.p
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Re: Issue for clicking cancel button in a dialog box

on Sat Dec 03, 2011 8:13 am
1. Try using FireFox with Firebug addon (with FirePath).
Determine what xPath aspect will identify the Cancel button.

2. After clicking Popup link, find dialogbox handle and use it to set
your driver to it: driver.switchTo().window(popupWin_ID);

3. Then use findElement(By.xpath(the Cancel button xPath identifier)).click()

I think that should work for you.
ccnnll
Posts : 6
Join date : 2011-12-03

Re: Issue for clicking cancel button in a dialog box

on Tue Dec 06, 2011 4:40 am
I am struggling with the same issue. In my case, the problem is finding
an xpath identifier for the cancel button. It's a JS generated dialog
so the firebug xpath includes a lot of divs with instance numbers that
change so I can't use that.

I'm trying to use a contains on the
class name but don't seem to have the syntax correct to get the web
element so I can click on it.

For example, I tried the following: xpath("//span[contains(@class,'ui-button-text'/'Cancel')]"

The code looks like:
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Re: Issue for clicking cancel button in a dialog box

on Tue Dec 06, 2011 4:48 am
maybe use the button attribute: aria-disabled="false"
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Re: Issue for clicking cancel button in a dialog box

on Tue Dec 06, 2011 2:58 pm
@ccnnll, try to use:
Code:
xpath("//span[text()='Cancel']");
ccnnll
Posts : 6
Join date : 2011-12-03

Re: Issue for clicking cancel button in a dialog box

on Tue Dec 06, 2011 9:38 pm
Thanks so much for the suggestions - faramka's xpath worked!
Sponsored content

Re: Issue for clicking cancel button in a dialog box

View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum