Tag Info

Hot answers tagged

4

I've tested using format http://user:pass@host and it works. So in Python (in setUp() of MyClass(unittest.TestCase) class) this should look like: self.base_url = "http://user:pass@host" In Java based on #34 at code.google, the following code should work as well: public void login(String username, String password){ WebDriver driver = getDriver(); ...


3

Oh Boy! you might start another one of the Java vs Python vs Other language war. These are kind of question which are always answered with preference for a specific language in mind. For me- I would prefer Python over Java, because of one reason : Its simplicity. Our test team comprises of people who have little programming experience. However, most of ...


3

driver = webdriver.Firefox() driver.implicitly_wait(10) # seconds driver.get("http:// enter your URL.") myDynamicElement = driver.find_element_by_id("myDynamicElement") Try above code and see if it is working or not.


3

wait = WebDriverWait(driver, 10) element = wait.until(EC.element_to_be_clickable((By.ID,'someid'))) Try above code and see if it is working or not.


3

In selenium the wait command doesn't really wait sometimes. That is there is some problem with that command. You can try the time.sleep(); command of python. It is an equivalent of the Thread.sleep(); command of Java. It will pause the execution of code for defined time limit. So you can give sufficient time that will allow your page to load. Hope it ...


3

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()


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

After you driver.get(URL) to your page, you can execute javascript in it from webdriver, like this driver.get('javascript:<your JS snippet here>') so try driver.get('javascript:localStorage.clear();')


2

If you are testing for a specific image at a specific resolution then you could either compare the image with the reference image or quicker calculate the MD5 of the image and compare it with the expected. Be sure and wait for the page to be loaded, including images, before validation.


2

You can put ChromeDriver wherever you like if you specify the path: chromedriver_path = "<path_to_chromedriver>" driver = webdriver.Chrome(executable_path=chromedriver_path) It's really up to you if you want in usr/local/bin or elsewhere.


2

Is there any specific reason to pick Java over Python? Not really. It depends on which language you feel more comfortable with. However, most of our developers (apart from the iOS devs, obviously) are intimately familiar with Python and are using it in our production environment. So go with Python. Then Devs can also contribute to e2e Test ...


1

The way I corrected this was to manually copy the ddt files from /usr/local/lib/python2.7/dist-packages to /usr/local/lib/python3.4/dist-packages Copied the following two files : ddt.py ddt.pyc and the directory ddt-1.0.0.dist-info If any body could come up with a better solution, then please add your answer. It would be more than welcome :)


1

Try and convert this to the Python equivalent. Check this link: For Firefox: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference( "intl.accept_languages", "es" ); WebDriver driver = new FirefoxDriver(profile); For Chrome: ChromeOptions options = new ChromeOptions(); options.AddArguments("--lang=es"); ChromeDriver driver = new ...


1

Your setup method should be setUp for unittest. I'm not sure why they decided to name it that way, but that's just how it is. Since setup is not a keyword it's not getting called, thereby making self.driver throw an AttributeError.


1

read up on Select object - http://selenium-python.readthedocs.org/en/latest/api.html?highlight=select#module-selenium.webdriver.support.select Use IDs or names, or even CSS before XPATH. Best practices, explained here


1

I was able to answer my own question, Please see script below: urlTextBox = "url" dropdownOption = "location" submitBtn = ".//*[@id='start_test-container']/p/input" homeBtn = ".//*[@id='nav']/li[1]/a" webTeamPage = "personalwebpage.com" select = driver.find_element_by_id(dropdownOption) #get the ...


1

Talking about UI testing you can try Sikuli - great tool which uses image recognition. Also it is a lib which can be installed with Sikuli: Tesseract which allows to grab/recognize text. It supports Python(Jython), Java, etc.


1

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.


1

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

For automatically testing an API in a CI/CD scenario, try Runscope. It integrates with several build/deploy tools, including Jenkins (see Jenkins integration instructions here). In fact, I just put out a Jenkins plugin for Runscope that makes it super simple -- API tests are just build steps. You'll find GitHub link to plugin on second link above. You can ...


1

The problem is that you don't switch to opened window, and webdriver searches for elements in the old page instead of the newly opened one. Solution: String winHandleBefore = driver.getWindowHandle(); for(String winHandle : driver.getWindowHandles()){ driver.switchTo().window(winHandle); } This java method's part switches to ...


1

I hope below given points may help you strong to see how this can be done: Find a web page which contains a broken image. Or you can create in your local system. Open your class file and write a code to locate an image such as below. You can use different image attributes(Eg. alt, name etc.) to locate image using XPath. WebElement ImageFile = ...


1

I had used browsermob-proxy and its Python client successfully in one of my project by using rewrite url to load mocking content. browsermob-proxy is a proxy server for the browser to connect with during testing. Assume you are hosting a webserver with mock content on localhost:8899, below example will load the mock content whenever the browser try to load ...


1

Try out Galen; it's designed for testing responsive web design across different platforms and different sized viewports, so its all about how web elements are laid out on screen: Layout testing seemed always a complex task. Galen Framework offers a simple solution: test location of objects relatively to each other on page. Using a special syntax and ...


1

Does your element put inside in iFrame? If it's in iFrame, you should switch driver to that. OR Could you try with element = driver.findElement(By.cssSelector("div.clearfix.stk_btm_toptabs.text-center>a.stk_btm_chpFlight.active"));


1

The problem could be that the page in the new window is still loading while you are trying to interact with it, so you might need to add in a wait condition. When I've done this, I've added in waits to make sure that the new window has actually been opened, and then to make sure the page in the new window is loaded. from selenium.webdriver.support.wait ...


1

thank you all for your suggestions. Though it's still not perfect, I now have a better working environment. I combined Artem's suggestion of removing external dependencies with Pushpendra's tip to boost up implicit_wait and page_load_timeout further up. They are now at 12 and 30, but I intend to go even higher. I've also increased the sleep times, as ...


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 ...


1

The possible reason might be that page looks to be rendered (UI elements are in place), but not completely loaded in browser. If there is any background calls, especially to 3rd-party services, it might take a while to reach them and get response, only then browser is able to mark the page as finally loaded.



Only top voted, non community-wiki answers of a minimum length are eligible