selenium-rc

Capturing JavaScript error in Selenium

三世轮回 提交于 2019-11-26 17:58:23
问题 Is there a way to capture errors occurring in the DOM in Selenium and probably flag the same as an error in the page? To give a brief example, let's say I'm trying to bind an event on a non-existing HTML control, my browser throws an error saying: element abcd not found in the console. Now, if I want the same error to fail my selenium tests and the message that is shown on the browser is shown as the error message. Is it possible to do something like this? 回答1: Put this script on your page

Checking HTTP Status Code in Selenium

好久不见. 提交于 2019-11-26 16:48:37
问题 How to get the HTTP status code in Selenium? E.g. so I can test that if the browser requests /user/27 and no user with ID=27 exists, an HTTP 404 is returned? My primary interest is Selenium RC, but if someone knows the answer for "normal" selenium, I can probably easily translate it into RC. /Pete 回答1: 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

Is it possible to hide the browser in Selenium RC?

牧云@^-^@ 提交于 2019-11-26 11:35:01
I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? Dave Hunt There are a few options: You could use Selenium Grid so that the browser is opened on a completely different machine (or virtual machine) that you can then connect to via VNC or Remote Desktop Connection if you wanted to see the browser. Also, another option: if you run a Jenkins foreground process on that remote server, it can execute your test project on the desktop. You can run Selenium 'headless

How to continue execution when Assertion is failed

大城市里の小女人 提交于 2019-11-26 08:27:50
问题 I am using Selenium RC using Java with eclipse and TestNG framework. I have the following code snippet: assertTrue(selenium.isTextPresent(\"Please enter Email ID\")); assertTrue(selenium.isTextPresent(\"Please enter Password\")); First assertion was failed and execution was stopped. But I want to continue the further snippet of code. 回答1: Selenium IDE uses verify to perform a soft assertion, meaning that the test will continue even if the check fails and either report the failures at the end

Is it possible to hide the browser in Selenium RC?

孤街浪徒 提交于 2019-11-26 02:28:22
问题 I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also? 回答1: There are a few options: You could use Selenium Grid so that the browser is opened on a completely different machine (or virtual machine) that you can then connect to via VNC or Remote Desktop Connection if you wanted to see the browser. Also, another option: if you run a Jenkins foreground process on

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

穿精又带淫゛_ 提交于 2019-11-26 01:07:29
问题 I have written the following code in Selenium 1 (a.k.a Selenium RC) for page scrolling using java: selenium.getEval(\"scrollBy(0, 250)\"); What is the equivalent code in Selenium 2 (WebDriver)? 回答1: 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