- anita.totad88
- Posts : 8
Join date : 2012-05-25
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
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
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
- anita.totad88
- Posts : 8
Join date : 2012-05-25
Re: selenium-Webdriver
Fri May 25, 2012 5:10 pm
it didn't work..
- ArahantActive particpant
- Posts : 23
Join date : 2012-02-29
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..
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..
- ashish_techieAmateur
- Posts : 73
Join date : 2011-08-09
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
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
- I downloaded and installed Selenium WebDriver Jar files in my Eclipse, but still i am facing issues and couldn't run the webdriver scripsts.
- Selenium IDE generated testcase script is not working in Selenium Webdriver
- Selenium webdriver Error - "Could not contact Selenium Server".
- Using Selenium Webdriver through selenium with fancy reporting
- selenium-Webdriver
Permissions in this forum:
You cannot reply to topics in this forum