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

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

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


2

At least on http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.5#getting-started is nicely detailled installation instructions.


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

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

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.


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

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

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

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

Selenium is not able to interact directly with OS functionality. So unless there is some backend service that allows you to create the connection through the browser somehow you can't use Selenium for this. Options: Write custom code to do this outside of selenium and then put it in the middle of your test Utilize another testing tool at least for the ...


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.


1

Well it depends on what you set up, in my environment I had Python, Java, PiP and EasyInstall loaded then it was simply a matter of running: pip install robotframework But it's simple enough to find the instructions on the Robot Framework site and check out the link to the Installation Instructions. The Robot Framework site has links to examples as well, ...



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