Tag Info

New answers tagged

0

Try following code to start server: APILauncher launcher = new APILauncher(true); launcher.Start();


0

Have you tried adding the Selenium IDE: Implicit Wait add-on? It might give you what you are looking for. "This plugin allows Selenium IDE to automatically wait until the element is found before executing each command using a locator. It is equivalent to the implicit wait function available with Selenium 2 WebDrivers." ...


0

tiennen07, Can you provide a link to a website, etc.. that has sample code for this. I tried doing this before, Java/WebDriver/TestNG running against Grid configuration, and I had tests stepping on each other - appeared to be confusion among webdriver instances. I'm sure it was my code, messing up how I was creating my webdriver instances from a test base ...


0

You might try WTFramework It seems like a decent starting place for python test infrastructure. I didn't end up using it because my tests ended up using more php and javascript. There are examples of using the page object design pattern.


0

I ended up writing my own Page Object framework which had some mobile-specific GUI automation features like locators by platform and other nice things so that my tests are platform agnostic. I'm considering open-sourcing it. Will post here with any updates on that, or if I find another Page Object framework in Python.


0

Your solution where you retry the sendKeys operation is the right idea. I do the same thing. You should have a sort of "retry" fallback. I also suggest running all failed tests twice after they fail and if they succeed at any point, they should pass. You can also try different Expected Conditions. I prefer to use "displayed and clickable" for most of my ...


1

@anshu Use .getText method and store the value in a string (Both step C and E) and compare the both the Strings, Ex: .equals. (Also you can use if-else condition).


0

Use webdriverWait and ExpectedConditions: from selenium2.webdriver.common.by import By from selenium2.webdriver.support.ui import WebDriverWait from selenium2.webdriver.support import expected_conditions as EC WebDriverWait(driver, WAIT).until(EC.element_to_be_clickable((By.ID, id)))


0

I believe that answers to your questions and more are in the The WebDriver Sampler: Your Top 10 Questions Answered guide.


0

According to me test automation is in itself a project - test automation as far as I believe is writing a program that will be used to test another program. So how about you consult the other stakeholders or say the developers in your company. If there is a project where developers have changed over time, discuss it with them about their experience of the ...


0

Try using submit() rather than click().


0

You could use driver.findElement(By.xpath(".//*[@id='ctl04_Pane2_AttributeDefinitionCategoryTest']/td[2]/div/select")).sendKeys(Keys.RETURN); for an easy fix. However there are ways to select by the value. Select select = new Select(driver.findElement(By.xpath(".//*[@id='ctl04_Pane2_AttributeDefinitionCategoryTest']/td[2]/div/select"))); ...


0

use driver.switchto().activeelement() before sending the arrow keys.


0

Assuming that you want to take a screenshot of the current action being performed the code in the above answer will be helpful for you. If you want to get an image displaying in a particular page check the code at below link. It extracts all links from a given page including links to image files. Modify the code to suit your need and you will get your ...


2

I just set the Selendriod up last week with this guide on the official site selendroid.io/setup.html. It's a step by step since System Requirements to the first test case. I think it's a good kickstart, pretty straight forward. You could post for a specific question, if you are struggling in any step. Hope it helps,


0

You can download the Java jar from http://docs.seleniumhq.org/download/. Unzip the file and move the (non-source) jar to where you keep your libraries for your Eclipse project. In Eclipse, you will need to add the jar to the list of libraries for your project build. You should now be able to create a test class and run some Selenium tests. There is a good ...


0

I think the easiest way to do this would be to manipulate the javascript on the page to get the two strings you need. First go to that primary shopping page and have the browser click the quick view this will load and give you a way to select the text use document.querySelector('h1 > a').textContent; and you should get something like "Roadster Men White ...


-1

It is giving you the web element just put .getText() whenever you see such code.


0

(I'm assuming that you mean Selenium Webdriver). If you want to get the image on the screen of a particular element, here's one way to get it: BufferedImage actualImageBuffer = null; File screen= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); int width=actualElement.getSize().getWidth(); int height=actualElement.getSize().getHeight(); ...


0

Something like this might help: public static Object scrollElementIntoView(WebDriver driver, WebElement element) { return ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); } Where element is the object to which we want to scroll to.


0

I needed to do this in javascript with protractor: browser.actions() .mouseMove( element(by.css('.material-dialog-container')) , -20, -20 // pixel offset from top left ) .click() .perform();


1

You are comparing values, so better you store each values in the String and compare both the String values.


0

The image processing based Sikuli works on optical recognition of screen elements rather than HTML elements and can be a method to get around those peskily changing IDs.


1

Use another identifier to identify the object or use xpath, for example: starts-with If your dynamic element's ids have the format where button id="continue-12345" where 12345 is a dynamic number you could use the following XPath: //button[starts-with(@id, 'continue-')] contains Sometimes an element gets identified by a value that could be surrounded ...


3

Sadly, it sounds like using the ID is not an option in this scenario A lot of websites implement security to prevent automating. While this makes your job more difficult it does improve the security of the application. So what can be done to bypass these security tricks? Use a different unique constant for that element This could mean using the class, ...


2

You can't capture the id's every time, you need to find some other way of uniquely identifying the elements. I'm assuming this is a 3rd party tool that you don't have any control over, but if you do have control you could ask the developers to provide either a unique ID or some other unique identifier. Some other options you have would be to identify ...


0

I've been using the following as a constant: FF_PROFILE_PATH = os.path.join(os.environ['APPDATA'], 'Mozilla', 'Firefox', 'Profiles') I believe it's consistent across OSes per Mozilla support documentation. To locate the correct profile, you can iterate through the list created by os.listdir to find the profile, as such: ...


1

Please use below code. driver.get("http://www.flipkart.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Trimmer")).click(); WebElement scroll = driver.findElement(By.id("brand")); scroll.sendKeys(Keys.PAGE_DOWN);


1

You can refer this link and let us know is this ok for you Link


0

This question is very broad, therefore the answer has to be broad as well. "mobile application testing" is as specific as "mobile application development". Applications are tested at different layers. One extremely important layer is exploratory testing, which requires that the tester runs the application in a setup that's as close as possible to that of a ...


2

Please Use select.selectByValue("Vodafone"); OR kindly post the HTML code and go through this Link Link As per your comments below updated the code: import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; ...


1

you can use following code to switch between windows based on the window title. or please go through this link Link private void handleMultipleWindows(String windowTitle) { Set<String> windows = driver.getWindowHandles(); for (String window : windows) { driver.switchTo().window(window); if ...


0

I've written some of these frameworks in the past and have followed a few guidelines in writing the code, and in creating design documents. My basic view is that if I have left and in 6 months someone needs to work on this, would they (or I) have the information they need to continue to work with the tool? If the answer is no, then you need to document. ...


0

If the code is for Selenium WebDriver, the documentation process can be greatly simplified with automated tools. Selenium supports Java very well, so unless you are using another language like C#, javadoc could be the way to go from a development maintenance point of view.


0

If you prefer to use PHP you're stuck with using the PHPUnit implementation of the bindings. Unfortunately I'm not aware of any BDD PHP framework that supports mobile devices. Information about php-client can be found at https://github.com/appium/php-client .


0

Often Selenium tests tend to become a bit messy, mainly as naturally they are initially written in a quick manner, just to progress through the scenario and as a proof of concept. In addition, extensive usage of XPATH can make the test look even more cryptic than it is already. As a result, the scripts become very hard to understand, at least from the first ...


1

Yes, definitely, documenting your project is absolutely necessary. But I'm not talking about for automation tests specifically, but for all programs in general. Selenium automation tests are programs just like anything else, which means that all coding standards within your company should also apply. The quality of the automation tests should be as high as ...


-1

Use sikuli or AutoIT to handle things not supported by Selenium directly


4

Yes, Selenium is an active project (see commit history on GitHub). Then why are there so many unresolved open issues? It's open source. We can't expect the team members to fix bugs on a daily basis, because they are just enthusiasts and all have real-life jobs. The developer in charge of a particular area may not have time to deal with it right away, even ...


0

WebDriver driver; //instantiated somewhere else, obviously WebElement element = driver.findElement(By.xpath("//div[@class='btnContr']/input[@value='Cancel']"); element.click(); Why are you bothering with JavascriptExecutor, when Selenium has the functionality to click an element selected by XPath built in?


0

Generally, it is bad practice to set the WebDriver instance as static. You should create a base class that each of your test classes extend so that each test class has its own instance of WebDriver to be used (this is especially important with parallel execution), then just declare/define your WebDriver variable within that base class.


1

As elcharrua writes you can use JavaScript in Java tests with the JavascriptExecutor. This will execute the JavaScript in the Selenium browser session if it was JavaScript from the website itself. But if you want to write the whole test in JavaScript look at WebDriver.JS Simple example var webdriver = require('selenium-webdriver'); var driver = new ...


0

Yes, you need to use JavascriptExecutor Class. Below is an example to scroll. public void scrollToElement(final WebElement element) { JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("arguments[0].scrollIntoView(true);", element); }


0

Your Selenium tests are focused on the integration of a number of pieces of your application. The questions you have answer are: Did you copy the code right? Did you copy the right code? Did the code get wired up inside the page right? It may help if you can factor out the part of your tests that is common to each of the pages. This allows you to check ...


0

As you said that the code is copied in various pages, and I suppose there are different elements on each of those pages. Maybe those different elements may or may not have different impact on the drop down list. Or the drop down list may have different impact on those elements in each page. So it would be better to make sure that the functionality is working ...


1

You can try appium, https://github.com/appium/appium I believe there is some support for web testing however it may not be stable at the moment. Another option would be to try a service like https://www.browserstack.com/automate


0

Googling for 5 seconds found http://selendroid.io/ - selenium driver for android. Does it help? What else you need?


2

Yes you should for the fact that it is "copied". Sure it is supposed to stay the same but if it is not the exact same code there is no guarantee that someone will not change the implementation. Write a test for that and then recall the same test method in every place instead of duplicating the test steps in every place. This will ensure it remains ...


0

IWebDriver has the method WindowHandles. The method return a collection. So you can use the size of the collection to get the number of open windows. IWebDriver Interface IWebDriver.WindowHandles Property I am not so familiar with C#, but in Java this work: driver.getWindowHandle().size(); In C# should this work: Driver.WindowHandles.Count;



Top 50 recent answers are included