what’s the relationship between Selenium RC and WebDriver?

You should probably start your research here (though you may have already gone over this): http://seleniumhq.org/docs/03_webdriver.html I’ll assume you’re contrasting Selenium-RC to WebDriver, Selenium-IDE really isn’t in the same ballpark. Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to … Read more

Difference between Selenium RC and WebDriver

Quoting from WebDriver and Selenium RC: Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using. Information on each ‘browser driver’ is provided later in this chapter. For those familiar with Selenium-RC, this … Read more

Get PID of Browser launched by selenium

Using the Python API, it’s pretty simple: from selenium import webdriver browser = webdriver.Firefox() print browser.binary.process.pid # browser.binary.process is a Popen object… If you’re using Chrome, it’s a little more complex, you go via a chromedriver process: c = webdriver.Chrome() c.service.process # is a Popen instance for the chromedriver process import psutil p = psutil.Process(c.service.process.pid) … Read more

Checking HTTP Status Code in Selenium

This might not be the best use of Selenium for this type of test. There is unnecessary need to load a browser when you could do and have a faster running test [Test] [ExpectedException(typeof(WebException), UserMessage = “The remote server returned an error: (404) Not Found”)] public void ShouldThrowA404() { HttpWebRequest task; //For Calling the page … Read more

Pass command line arguments to JUnit test case being run programmatically

You can use java system properties to achieve this. Simply pass what you need with -Dconnectionstring=foobar in the junit command line, or use the java api for system properties to set this programmatically, with System.setProperty(String name, String value), and System.getProperty(String name). In your tests, you can use the @Before or @BeforeClass to set up common … Read more

Page scroll up or down in Selenium WebDriver (Selenium 2) using java

Scenario/Test steps: 1. Open a browser and navigate to TestURL 2. Scroll down some pixel and scroll up For Scroll down: WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript(“window.scrollBy(0,250)”); OR, you can do as follows: jse.executeScript(“scroll(0, 250);”); For Scroll up: jse.executeScript(“window.scrollBy(0,-250)”); OR, jse.executeScript(“scroll(0, -250);”); Scroll to the bottom of the page: Scenario/Test steps: … Read more

Capturing JavaScript error in Selenium

I’m doing this to capture JavaScript errors: [TestCleanup] public void TestCleanup() { var errorStrings = new List<string> { “SyntaxError”, “EvalError”, “ReferenceError”, “RangeError”, “TypeError”, “URIError” }; var jsErrors = Driver.Manage().Logs.GetLog(LogType.Browser).Where(x => errorStrings.Any(e => x.Message.Contains(e))); if (jsErrors.Any()) { Assert.Fail(“JavaScript error(s):” + Environment.NewLine + jsErrors.Aggregate(“”, (s, entry) => s + entry.Message + Environment.NewLine)); } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)