Tag Info

New answers tagged

2

If you're trying to register 100 accounts, this is a simple addition to your code to do that. for i in range(100): email_address = "money" + str(i) + "@qa.test" firstName.send_keys("mike") lastName.send_keys("mano") emailField.send_keys(email_address) passwordField.send_keys("test12") submitButton.click()


3

Try to use driver.findElements instead. It returns a list of all WebElements. All means also the not visible elements. Here some code to iterate thru the list and only do something with the displayed items. List<WebElement> elements = driver.findElements(By.className("vfmThumbnail")); java.util.Iterator<WebElement> i = elements.iterator(); ...


1

If you want all elements that match your selector, use findElements. This will return a list which you can iterate through. List rows = wd.findElements(By.className("vfmThumbnail"));


2

You are getting a nullpointer exception because you're trying to assign values to index locations in a null array. This statement String[] tradeId = null; should be String[] tradeId = new String[list.size()]; so when you later do this: tradeId[i] = str.substring(s.lastIndexOf('-') + 1); There will be a space in the array reserved for that value. ...


0

The solution I would use is the WebDriver's driver.switchTo().frame() method (as per your example) You can select the window you want using; A number. (0 based index) A name or ID. A previously found WebElement. an example driver.switchTo().frame(driver.findElement(By.className("uniqueElement[title='The Page You Are After']")));


0

To perform a 'mouse hover' action, you need to concatenate all of the actions that you want to achieve in one go. With the actions object you should first move to the text box, and then move to the edit icon and click it. Below is my attempt at sample code to perform Mouse hover; //Move to the Textbox Actions actions = new Actions(driver); ...


0

To perform a 'mouse hover' action, you need to concatenate all of the actions that you want to achieve in one go. With the actions object you should first move the menu title, and then move to the sub menu item and click it. Below is my attempt at sample code to perform Mouse hover action using your paths; Actions actions = new Actions(driver); ...


0

I think the By.ClassName does not support spaces in the selector. If the element is a new window, you first need to switchTo() the window, see this for an example Try: driver.findElement(By.cssSelector("a[class='btn btn-sm blue']")); Or driver.findElement(By.xpath("//a[contains(@class, 'btn') and contains(@class, 'btn-sm') and contains(@class, ...


0

Refresh the browser AFTER clicking the '+' icon and then use find_element or find_elements functions. Something like this. driver.find_element_by_id("+").click() driver.refresh() elements = driver.find_elements_by_tag_name("a") for element in elements: if "your_link" in element.get_attribute('href'): element.click() I faced a ...


0

I prefer to use XPATH against CSS selectors, because in dynamic applications, the CSS can by changed. In this case, there is possibility to use Xpath locators with functions contains, starts-with, ends-with: driver.findElement(By.XPATH, '//element[contains[@attribute,'text']]') driver.findElement(By.XPATH, '//element[starts-with[@attribute,'text']]') ...


3

How do you come to 23 in tradeId[i] = str.substring(23);, your strings like trade-summary-92222 are only 19 characters long, not? 19 - 23 = -4, which is what your errors says its can't find the last 4 characters. For readability and a partial string you could use: public String substring(int beginIndex, int endIndex) Your code would become: tradeId[i] = ...


1

WebDriver cannot be used todo browser specific actions, it can only be used to drive the web-page. Although sending the keys CTRL-TAB might switch tabs WebDriver will still think you are in the previous window. Switching Tabs as you want is thus actually something different. Each tab is actually a window organised in a tab like look-and-feel. Thus you ...


0

I think a set limit does not exist and tests should run until you stop them. I do wonder if you really need to check all pairs and if isn't that easier checked in a unit-test. It should also be possible to write unit-tests for JavaScript actions that populate drop-downs. Check only a couple of pairs in the actual GUI, because testing all pairs with Selenium ...


0

You are comparing apples and oranges. Selenium works off the DOM, not off the page source. For a more fair comparison, try opening the browser debugger and searching for "cloud front".


2

data-href is an attribute of a HTML tag, try to use get_attribute method, something like: url = browser.find_element_by_xpath("//a").get_attribute("data-href") For more information see: http://selenium-python.readthedocs.org/en/latest/api.html#selenium.webdriver.remote.webelement.WebElement.get_attribute Or this for examples: ...


2

Run all the tests just right after the build as soon as possible, before deploying to the test environment. Developers should have feedback about their check-ins as soon as possible. Also you say the test-env is used for manual testing, why would you want to risk deploying a non working build. Certainly if you could have run the tests first. In short the ...


0

Instead of using a sleep I would wait until more then one window is present. driver.getWindowHandles().size() returns the number of windows, it should be one more then before the clickButtonForNewWindow action. long endTime = System.currentTimeMillis() + 10000 while(driver.getWindowHandles().size() >= 1 && System.currentTimeMillis() < endTime) ...


2

If QA and DEV environments are equal (have the same dependencies installed, the same build, etc.), there is no much sense to run acceptance tests on both of them, since it will be just duplicated execution and additional overhead in terms of analysing test results on two environments instead of one. Acceptance tests are the tests which provide you ...


1

to my experience in automation test, it is more valuable to run in qa environment but you should communicate with developer frequently on changing part which may affect your automated test cases so you can prepare your automated test cases during development phase and give priority to more static features of the product to prevent updating automated cases ...


3

Steps: Open page with form Leave fields empty Submit form Wait for message to appear with an Explicit wait Assert message text and color are correct You can use .GetCSSValue("color") on a webElement to get its color value. For an example look at: http://stackoverflow.com/questions/19668893/getcssvalue-color-in-hex-format-in-selenium-webdriver


0

You need to provide more information to be given any particularly detailed answers, but essentially the test case would navigate to your form and clear any text from the address field (you may need to enter some text then clear text from the field depending on how your form works). After this you should be able to see the application message, so you need to ...


0

I won't add the same as what's already been said, but.. I noticed one of your selectors is by option value 293, or similar As a rule of thumb, try not to use numerical or 'generated' selectors on things like this, as if there were another option added to the drop down you might end up selecting a totally different option.


1

This answer might not seem very useful right now, but tools which automatically generate xpath or css for an element pretty much never do a good job of creating a selector which is not brittle. I strongly advise that you spend a day or two learning in depth either xpath, or css (Webdriver supports either, css selectors tend to be a bit quicker) as it is ...


0

I am not able to access Ebay in my pc because of some firewall restriction , but I can help you by example : You will need to use Select object to select value from dropdown. For ex : driver.get("http://www.toolsqa.com/automation-practice-form/"); Select sel = new Select(driver.findElement(By.id("continents"))); sel.selectByVisibleText("Australia"); So ...


2

The best way is to separate out the details of the WebElement and methods to do with clicking on it, into separate classes - keeping a separation between the code which directly interacts with the UI and the code which does the testing logic. This is a design pattern called the Page Object Model, and your code will end up looking a bit like this: package ...


1

Selenium standalone jar and testNg jars are missing . So just keep these jars in you Lib folder and this will resolve your problem. Since in build.xml you have provided jar location to lib folder. So please keep all your jar files in lib folder and this will start working without showing any error. Good Luck


0

Your className selector isn't working, because those are two different class names - you can't use both at once. Try either of these selectors to see if they find the X correctly: driver.findElement(By.className("fancybox-item")).click(); or driver.findElement(By.className("fancybox-close")).click(); But remember to double-check that there aren't any ...


0

I am not sure on how to get the Selenium version through code. I dont think there are any methods to do so. But, the version is clearly mentioned in the CHANGELOG file that comes along with your Selenium installation. You can read the version from this file. Below is the content of the log file: v2.43.0 ======= WebDriver: Updating Native ...


0

Please post your frame html code. Make sure your driver is switching to frame successfully. Is Content your frame name? You can switch to frame using three different ways. driver.switchTo().frame(<frame name>); driver.switchTo().frame(<frame index>); // Zero- based index driver.switchTo().frame(<frame element>); // use driver.findElement ...


1

If you have some input fields, most likely you also have some limitations related to max. number of chars which user can enter there. Let's say you have text input field which allows user to enter up to (and inclusive) 255 chars. In this case simplified test scenarios will be: User enters any number of valid chars (the number of chars should be <255) ...


0

Just a wild guess without any testing, but shouldn't it just be: find_element(:xpath,"//*[contains(.,'602384710')]../..").click The problem is that when searching with the results of a find_element it cannot go back up the tree anymore, from then on it will only search within the already found results.


0

I have tested this XPath online. Please try: //a[contains(.//div,602384710)]


0

Your if statement feels like it's not even there because when your test encounters and exception and dies, that if statement effectively is not even there. The line of code that is dying is this: xpath = driver.find_element_by_xpath( "/html/body/main/div/article[2]/div[4]/header/div[2]/div/div[4]/a") Your if statement never gets a chance to run. This ...


3

Short answer: Yes it is a bad practise, unless you have a very very very good reason, do not use implicit wait. This Stack Overflow answers really puts the difference in great detail. I once had someone on my team who thought it was a good idea, until I started researching why all our tests had such a long starting time. Somewhere in our setup the implicit ...


0

You have two options. If you're using findElement relative to another WebElement, your XPath needs to start with a dot (the element as your starting point). See the accepted answer in this topic. Alternatively, the XPath contains goes looking in child nodes too. You could try to immediately target the link element like so: "//a[@class='tv-card-link' ...


0

You should write on programming language which you know better and make sure that your colleagues familiar with Java or Python in case of your support. I guess your question has answer and you should start to write on Java. But you will not get any pain if you will try to learn Python because Python is easier to understand in my opinion.


0

The answer to your question is dependent upon your familiarity of the programming language. You should use the language which you are more familiar with and feel comfortable using it. When you will be writing scripts, you will have to implement complex scenarios, which will require you to write complicated logic and once you are done with it, in the future ...


0

The question seems to imply that you need to check whether the page is correct during the performance test. There is a price to be paid for checking correctness during a performance test: these tools are optimized for performance testing rather than functional testing, and so you may have to go through more effort to check a page's correctness than you ...


0

In fact any load testing tool has validations and assertions. If you're looking for free and open source solution the most promising tools as for now are: Gatling Grinder Tsung Apache JMeter You can check out Open Source Load Testing Tools: Which One Should You Use?, it highlights main features of aforementioned load testing tools, contains sample demo ...


0

I found this article that describes Selenium architecture and how Selenium works. Quote from the article: WebDriver controls browsers that are running in other processes. Although it's easy to overlook it, this means that every call that is made through its API is an RPC call and therefore the performance of the framework is at the mercy of network ...


1

Yes, it most certainly does. Selenium can only address elements once they're loaded, but that loading (controls, ajax calls, ...) is depending on your connection (and browser). In fact, I had a perfectly working script with nice explicit waits for our test environment. But the execution on the production website went bad in places, because the ajax calls ...


2

A quick search for Selenium tests on github results in multiple open-source projects hosting their test cases there. Wikia: https://github.com/Wikia/selenium-tests Jenkins CI: https://github.com/jenkinsci/selenium-tests Mozilla Addons: https://github.com/mozilla/Addon-Tests Other open-source project sites look at: http://sourceforge.net/ ...


1

At this point of time it doesn't matter which language you'll start with, 'cause both are relatively easy to learn considering the number of educational resources available. The more important thing is the language your application under test is developed with. In case when the application under test written in Java and you do your automated testing ...


0

According my experience JAVA is better if you think about scope and career. I agree with @user246. Also you will have vast area , lots of tutorials to use java with selenium. If you have good command over python programming then you should not switch to java for selenium.


0

Selenium + Java has a lot of tutorials / examples / documentation available. I believe there's plenty of documentation available on using TestNG in Java or the ATU Graphical Reporter if you are into designing automation framework or reporting structures. So, you might find it easier to start Selenium with Java.


0

They work equally well. If you have never programmed before, it may be easier to start with Python. If you want an eventual career as a developer, you will eventually want to learn Java.


0

This is how it can be done - Download selenium from here https://pypi.python.org/pypi/selenium Assuming that you are on windows use - python setup.py install Download IEDriverServer.exe and put it in your path from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Ie("C:\\Python34\\IEDriverServer.exe") //Your ...


0

Here is what we did at my company: write a webapp that talks to Gmail over IMAP. The webapp displays your inbox, or individual messages, in a form that is easy for Webdriver to process. It can also display individual messages.


0

You seem to be trying to select the a tags based on an attribute which is on a font tag. Instead, try the xpath selector //a[@target='SearchFrame'] to select all the links. You can use Driver.SelectElements to return these as an IEnumerable<IWebElement>. Sorry if the selector isn't quite right, I'm trying this on my phone so can't check back to the DOM ...


1

Webdriver is a browser manipulation API only and as such the ability to read office or PDF files is out of scope of its capabilities, but the office interop libraries will allow you to read data from office files in C#, and there will be similar libraries for reading PDF documents.



Top 50 recent answers are included