Quality is delighting customers
Started this discussion. Last reply by Rucha A Mar 2, 2012. 6 Replies 1 Like
What are the Keyword and Data driven frameworks?Continue
Started this discussion. Last reply by SantoshSarma Mar 15, 2012. 5 Replies 0 Likes
Where do you store logs? And how do you handle exceptions when you executed a scenario by using selenium tool.Continue
Started this discussion. Last reply by vidhya Shankar Dec 21, 2011. 2 Replies 0 Likes
Can we discuss about Data driven in selenium RcHow does it works?How selenium identifies data in excel sheets?Continue
© 2022 Created by Quality Testing.
Powered by
Comment Wall (5 comments)
You need to be a member of Quality Testing to add comments!
Join Quality Testing
Thank You Ravi...
How to get values from a list box and how to select particular item from tht using WebDriver
import com.thoughtworks.selenium.Selenium;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.*;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.ie.*;
import org.junit.*;
import static org.junit.Assert.*;
public class ScrmExample {
WebDriver driver;
Selenium selenium;
@Before
public void startSelenium() {
driver = new FirefoxDriver();
//driver = new InternetExplorerDriver();
//selenium = new WebDriverBackedSelenium(driver, "http://127.0.0.1/");
}
@Test
public void testScrmExample() throws InterruptedException {
try {
//Invoke sugar C R M application
driver.get("http://127.0.0.1/sugarcrm/index.php?action=Login&module=Users");
//it will clear the existing value in a text box
driver.findElement(By.id("user_name")).clear();
//enter user name
driver.findElement(By.id("user_name")).sendKeys("admin");
//it will clear the existing value in a text box
driver.findElement(By.id("user_password")).clear();
//enter PassWord
driver.findElement(By.id("user_password")).sendKeys("admin");
//String s = driver.findElement(By.id("user_password")).getText();
//click on login Button
driver.findElement(By.id("login_button")).click();
//wait for login
selenium.waitForPageToLoad("30000");
//click on Home Link
driver.findElement(By.xpath("//*[@id='header']/table/tbody/tr[3]/td/table/tbody/tr[1]/td/table/tbody/tr/td[2]/table/tbody/tr/td[2]/a")).click();
selenium.waitForPageToLoad("30000");
//click on create contact link
driver.findElement(By.xpath("//div/table/tbody/tr/td/div/ul/li/a")).click();
selenium.waitForPageToLoad("30000");
//driver.findElement(By.name("salutation")).options(i).value;
//document.formName.listboxname.options[i]
var selectTitle = new var(driver.findElement(By.name("salutation")));
selectTitle.selectByValue("Mr.");
//driver.findElement(By.id("name_advanced")).sendKeys("Raghavendra");
//driver.findElement(By.id("billing_address_city_advanced")).sendKeys("stae");
//WebElement element = driver.findElement(new ById("chris_id"));
//var document = new Object();
//document.getElementById("chris_id");
//selenium.getEval("document.getElementsByName('assigned_user_id_advanced[]').innerHtml");
//selenium.waitForPageToLoad("50000");
//WebElement a = driver.findElement(By.xpath("//x:table/x:tbody/x:tr[1]/x:td/x:table/x:tbody/x:tr[3]/x:td[2]/x:select/x:option[2]"));
//System.out.println("valus are"+a);
//System.out.println("Text is" + s);
} catch (Exception e) {
// TODO: handle exception
}
}
@After
public void stopSelenium() {
driver.close();
}
}
In the above code i want to select Mr. frm weblist can u suggest me how to write code for tht
Hi Ravi Kumar i need u r help to work on selenium could u plz help me ...
Regard's
Raghavendra N
Dear Ravi,
Welcome to Quality Testing!
-QT Team
Hello Ravi,
Welcome to QT .......enjoy Testing !!! TC GOD BLESS U ALLLLLL
Thanks & Regards
Kapil
kapildevkapoor@gmail.com
visit :http://testingking.weebly.com
+919326814689