selenium-rc

Selenium cannot get alert thrown in iframe

隐身守侯 提交于 2019-12-24 20:35:00
问题 I am trying to capture the alert using selenium RC C# function getAlert() as a result of checking the availability of an account ID when the button is clicked. The form will be submitted to the server from one frame let's say "frame_A" and the server will response by javascript code "alert("The account is available")" into another frame called "frame_B" but somehow the selenium getAlert() cannot detect the existence of the alert. Have been looking for solutions, but so far have not found it.

Searching for an image by src in Selenium

帅比萌擦擦* 提交于 2019-12-24 17:28:03
问题 I have to write a Selenium test and I need to get an element by the src as there is no ID for it. How do I go about doing something like //div[@id='content-inner'] but with @src='../mapshop/images/buy.png' or even better using a contains 'buy.png'? I've tried testing if the image is there but, selenium.IsElementPresent("//img [@src='../mapshop/images/buy.png']") but that just returns false. 回答1: Found the problem. Very simple. Needed to specify the full image url not just the src selenium

Group/Filter in phpunit doesnt execute specific test case

不打扰是莪最后的温柔 提交于 2019-12-24 04:42:30
问题 i have a suite that calls multiple suites and many functions for LOG,REPORT and Execution if i m trying the same 'Group or Filter' pattern its executes all the test cases without executing the selected single test cases. Edit: I am using an array suite as follows, $suite->addTestSuite('adminSuite'); $suite->addTestSuite('staffSuite'); $suite->addTestSuite('merchantSuite'); // Run the test PHPUnit_TextUI_TestRunner::run($suite, array( 'junitLogfile' => $path_log )); I am calling this file

Selenium RC: How to check if an element has a given attribute?

此生再无相见时 提交于 2019-12-24 04:13:09
问题 I have some buttons with an onclick attribute and some that don't. I want to check if the specified element has the onclick attribute. How can I do this? getAttribute() returns the attribute value when it has one. When it doesn't, it throws a RuntimeException and stops the test (even when I wrap it in a try/catch block). $onclickValue = $this->getAttribute("$locator@onclick"); //works when the attribute exists 回答1: By using getEval() , you can execute the javascript hasAttribute() function.

selenium.captureEntirePageScreenshot does not work but selenium.captureScreenshot works

对着背影说爱祢 提交于 2019-12-24 02:09:53
问题 I'm running Selenium with TestNG using Eclipse and Selenium RC. I used the command: selenium.captureEntirePageScreenshot("\\test.png",""); but got the following error: com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath] Can someone please suggest

Selenium RC throws sessionsid should not be null exception with assertTextPresent, phpunit 3.4 bug only?

删除回忆录丶 提交于 2019-12-23 12:26:12
问题 I am looking to migrate my selenium RC tests to using PHPUnit 3.4.12 from PHPUnit 3.3.2. The selenium test will fail with an exception of the following when I use assertTextPresent() : PHPUnit_Framework_Exception: Response from Selenium RC server for getLocation(). ERROR Server Exception: sessionId should not be null; has this session been started yet?. For example: public function testSending($browser) { ... $browser->click("send"); $browser->waitForPageToLoad("30000"); $browser-

Regular expression for xpath in selenium java code

我的梦境 提交于 2019-12-23 05:27:33
问题 Selenium java code for regular expression. Xpath = "//*[@id='gritter-item-6']/div[2]/div[2]/p" In above xpath 6 is varying, any one help me how to solve this problem Please give me the solution for this. 回答1: Try using the below xpath where we use contains keyword. //*[contains(@id, 'gritter-item-')] 回答2: To make it more accurate, you can use starts-with() instead of contains() , since your IDs are starting with specific string. You can use : //*[starts-with(@id, 'gritter-item-')] 回答3: I had

get CSS Property values using selenium

为君一笑 提交于 2019-12-23 05:19:42
问题 How to get the property value of a CSS class using selnium RC I tried it using webdriver but can't get what is required 回答1: You can use the getEval(String script) command to evaluate javascript to fetch the property. Selenium can be pretty limited in this sense EDIT: this.style.someAttribute will give you the value of someAttribute css style for the given Selenium node. Also, if you want to run JavaScript on elements within the document body, such as document.getElementById .., you need to

Where to click on this following object(button), for the values to be displayed in Selenium(Webdriver)?

江枫思渺然 提交于 2019-12-23 05:08:42
问题 <table id="ext-comp-1389" class="x-btn x-btn-text-icon " cellspacing="0" style="width: auto;"> <tbody class="x-btn-small x-btn-icon-small-left"> <tr> <tr> <td class="x-btn-ml"> <td class="x-btn-mc"> <em class="x-btn-split" unselectable="on"> <button id="ext-gen128" class="x-btn-text create" type="button">New</button> </em> </td> <td class="x-btn-mr"> <i> </i> </td> </tr> <tr> </tbody> </table> Above is the way, the New button is present in the HTML file... The behavior of the button is it has

Complications with Selenium's GetAttribute method

落花浮王杯 提交于 2019-12-21 17:23:31
问题 I recently attempted to use selenium RC's GetAttribute method but immediately ran into a challenge. I tried to execute a very simple selenium.GetAttribute("//a/@href") but the code threw a SeleniumException with the message "ERROR: Could not find element attribute: //a/@href" . By substituting selenium.GetText("//a[@href]") in place of the GetAttribute call, I confirmed that an element was definitely present, as this statement properly returned the text of the link. I then tried: pointing to