Rocky's Profile
Doctor
225
Points

Questions
10

Answers
12

  • Doctor Asked on September 27, 2014 in Selenium WebDriver.

    Hi Young,

    Below links may useful for your query.

    http://www.toolsqa.com/selenium-webdriver/http-proxy-authentication/

    http://stackoverflow.com/questions/2887978/webdriver-and-proxy-server-for-firefox

    http://stackoverflow.com/questions/14235802/how-to-set-auto-detect-proxy-settings-in-selenium-webdriver-using-java

    http://seleniumworks.blogspot.in/2013/02/how-to-set-proxies-with-username-and.html

    • 967 views
    • 2 answers
    • 0 votes
  • Doctor Asked on September 27, 2014 in Selenium WebDriver.

    Hi Ravinder Reddy,

    To verify whether image is present or displayed or not, please use below code sample. May this will help for you.

    Absolute xpath is not good when you have dynamic identifiers (As I know).

    driver.get(“https://www.vodafone.in/pages/home_kar.aspx?cid=kar”);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    WebDriverWait wait = new WebDriverWait(driver, 30);
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath(“//img[contains(@src,’../_layouts/images/vf/banners/herospace/923201430138PM_HB(1).jpg’)]”)));
    if(driver.findElement(By.xpath(“//img[contains(@src,’../_layouts/images/vf/banners/herospace/923201430138PM_HB(1).jpg’)]”)).isDisplayed()){
    System.out.println(“923201430138PM_HB(1).jpg Displayed”);
    }else{
    System.err.println(“Not displayed”);
    }
    driver.quit();

    • 14385 views
    • 8 answers
    • 1 votes
  • Doctor Asked on September 26, 2014 in Selenium WebDriver.

    Hi Surekha,

    Let us know your code and suite also and I didn’t understand your expectation. As per my understanding I am suggesting below code.

    You do not want to launch 2 browsers correct?. If yes, you the below code.

    If not, just use the proper Annotation.

    Also go through the below link:

    Link:

    http://stackoverflow.com/questions/20833168/selenium-and-testng-all-test-in-one-browser

    Code:

    private static WebDriver driver;

    @BeforeTest
    public static void beforeMethod() {
    driver = new FirefoxDriver();
    }
    @Test(priority=1)
    public void main1() {
    driver.get(“http://indianrail.gov.in/pnr_Enq.html”);
    driver.findElement(By.id(“element”)).sendKeys(“1234567890”);
    String captcha = driver.findElement(By.id(“txtCaptchaDiv”)).getText();
    System.out.println(captcha);
    driver.findElement(By.id(“txtInput”)).sendKeys(captcha);
    }
    @Test(priority=2)
    public void main2() {
    driver.findElement(By.className(“btn_style”)).click();
    }

    • 918 views
    • 3 answers
    • 0 votes
  • Doctor Asked on September 9, 2014 in Selenium WebDriver.

    As per my understanding below are few limitations:
    Additional time is spent in analyzing the test cases to identify with reusable flows.
    Test Data is hard coded within the scripts.

    • 1328 views
    • 2 answers
    • 2 votes
  • Doctor Asked on September 6, 2014 in Selenium WebDriver.

    Need a simple logic (Not MDF) to verify selected items are same as in the Cart .

    • 1745 views
    • 5 answers
    • 1 votes
  • Doctor Asked on September 6, 2014 in Selenium WebDriver.

    Virender I am working on MDF and I am pasting screenshot may you can understand (Hopefully).

    Function is below:

    
    public static WebElement productCategory_Accessories(WebDriver driver){
    
    WebElement element = driver.findElement(By.linkText("Product Category"));
    
    Actions action = new Actions(driver);
    
    action.moveToElement(element).perform();
    
    WebElement subElement = driver.findElement(By.linkText("Accessories"));
    
    action.moveToElement(subElement);
    
    action.click();
    
    action.perform();
    
    return element;
    
    }
    
    

    Called above function:
    HomeActs.productCategory_Accessories(driver);

    1st step: Selected the items

    RE: How to validate?

    2nd Step: In the cart page, selected items are displayed and verify the Selected items are same as above (Step no 1). How to do this? 

    RE: How to validate?

    Hope all is well 🙂

    • 1745 views
    • 5 answers
    • 1 votes
  • Doctor Asked on August 26, 2014 in Selenium WebDriver.

    @Vaidy: The link is working fine, just verified. Please verify from your end if required.

    Thanks.

    • 1916 views
    • 3 answers
    • 1 votes
  • Doctor Asked on August 26, 2014 in Selenium WebDriver.

    Hi Carol,

    Please use below lines in your code.

    
    driver.get("http://www.expedia.co.in/");
    
    driver.findElement(By.xpath(".//*[@id='popupmodal']/div/div[1]/a")).click();
    
    
    • 1250 views
    • 4 answers
    • 0 votes
  • Doctor Asked on August 25, 2014 in Selenium WebDriver.

    Yup, thank you.

    • 848 views
    • 2 answers
    • 0 votes
  • Doctor Asked on August 24, 2014 in Selenium WebDriver.

    Hi Kishore,

    This link may help you – LINK, if this link will not help then please elaborate your question or post your code, so we can look into this.

    This answer accepted by kishore. on December 12, 2014 Earned 15 points.

    • 848 views
    • 2 answers
    • 0 votes
  • Doctor Asked on August 24, 2014 in Selenium WebDriver.

    Hi Ankit,

    We are on the same boat, but bit difference is there. Please find below code I am also using “Title” to switch. But need to know what is the use of o/p of the getwindowhandle/handles()?, how we can use it in coding?.

    
    if(driver.getTitle().equals("Way2SMS - Contact"))
    
    
    • 23270 views
    • 4 answers
    • 1 votes
  • Doctor Asked on August 23, 2014 in Selenium WebDriver.

    Hi Vaidy,

    I am looking into particular solution, how to switch to a particular window using handle/String values?.

    Below is the sample code:

    
    import java.util.concurrent.TimeUnit;
    
    import org.junit.Test;
    
    import org.openqa.selenium.By;
    
    import org.openqa.selenium.WebDriver;
    
    import org.openqa.selenium.firefox.FirefoxDriver;
    public class Test2 {
    
    @Test
    
    public void test5() throws Exception {
    
    WebDriver driver = new FirefoxDriver();
    
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    
    driver.get("http://site22.way2sms.com/content/index.html");
    String mainwindow=driver.getWindowHandle();
    
    System.out.println("Main window value: "+mainwindow);
    
    driver.findElement(By.linkText("Contact")).click();
    for(String popup :driver.getWindowHandles()){
    
    driver.switchTo().window(popup); // How to switch to these values?.
    
    System.out.println("Popup values: "+popup);
    
    }
    
    driver.switchTo().window(mainwindow);
    
    driver.quit();
    
    }
    
    }
    
    
    • 23270 views
    • 4 answers
    • 1 votes