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
anita.totad88
Posts : 8
Join date : 2012-05-25

selenium-Webdriver Empty selenium-Webdriver

Fri May 25, 2012 3:59 pm
Hi All,

The problem I am facing here that actually i need to click on alert message dialog "Ok"
the code is here
"span class="jsx30button_text" style="position: relative; display: inline-block; height: 12px;" jsxtabindex="0" tabindex="0">Delete "/span"

but i tried with following commands:
//span[@class='jsx30button_text']
but it did not work.
could you please help on this
rohit13
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 37
Location : INDIA
http://radical-qa.blogspot.in/

selenium-Webdriver Empty Re: selenium-Webdriver

Fri May 25, 2012 4:31 pm
As alert is java-script generated, n you are using webdriver..Use below command
Code:
IAlert alert = driver.SwitchTo().Alert();
string alertText = alert.Text;// Get the text
alert.Accept();// Accept
avatar
anita.totad88
Posts : 8
Join date : 2012-05-25

selenium-Webdriver Empty Re: selenium-Webdriver

Fri May 25, 2012 5:10 pm

it didn't work..
avatar
Arahant
Active particpant
Active particpant
Posts : 23
Join date : 2012-02-29

selenium-Webdriver Empty Re: selenium-Webdriver

Mon May 28, 2012 12:22 pm
Try with following steps.

1) After click on web element which is going to popup alert dialog.
2) Then use this code.

drive.switchTo().alert().accept();

Hope will work..
avatar
ashish_techie
Amateur
Amateur
Posts : 73
Join date : 2011-08-09

selenium-Webdriver Empty Re: selenium-Webdriver

Tue May 29, 2012 2:23 pm
YES, YOU CAN USE THIS CODE

drive.switchTo().alert().accept();

OR

Alert alert = driver.switchTo().alert();
// alert.accept(); - to click OK
// alert.dismiss(); - to click cancel

it will work if it is a Alert. To check this you can see the page source.


regards
Ashish Thakur

For selenium training visit www.qtpselenium.com/selenium-training



Sponsored content

selenium-Webdriver Empty Re: selenium-Webdriver

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