Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
216 views
by The go-to Tester (218 points)

I have wrtiten test using Webdriver+TestNG. Although the test passes but I am not getting expected result. My code is as follows

public class TestNG {
 
public WebDriver driver;
  @Test
  private void login() {
 driver.get("www.yahoo.com");
      String title = driver.getTitle();
      System.out.println(title);
  }
 
  @BeforeMethod
  public void beforeMethod() {
System.setProperty("webdriver.gecko.driver", "C://Selenium driver/geckodriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
      driver = new FirefoxDriver();
      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  }
 
  @AfterMethod
  public void afterMethod() {
      driver.quit();
  }
 
}
 
Output that I am getting is-:
Firefox — Features — Mozilla
But it should be -: Yahoo
Please Help

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer
It looks like your Firefox browsre and your selenium versions are not matching. Try to use Firefox version  50.0.2 or less but higher than the version 50.0.0 and Selenium version 3.0 or more.

Your current Firefor browser is not supported by the latest selenium. Also, see if you have any unwanted AddOn installed, spatially the one from your Antivirus.

 

Hope that helps.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...