Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
sumanpasupula
Posts : 2
Join date : 2011-04-12

Issue for clicking cancel button in a dialog box Empty Issue for clicking cancel button in a dialog box

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
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

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.
avatar
ccnnll
Posts : 6
Join date : 2011-12-03

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

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>
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

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

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

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

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

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

Issue for clicking cancel button in a dialog box Empty Re: Issue for clicking cancel button in a dialog box

Back to top
Permissions in this forum:
You cannot reply to topics in this forum