Random “Element is no longer attached to the DOM” StaleElementReferenceException

Yes, if you’re having problems with StaleElementReferenceExceptions it’s because there is a race condition. Consider the following scenario: WebElement element = driver.findElement(By.id(“foo”)); // DOM changes – page is refreshed, or element is removed and re-added element.click(); Now at the point where you’re clicking the element, the element reference is no longer valid. It’s close to … Read more

Should one test internal implementation, or only test public behaviour?

The answer is very simple: you are describing functional testing, which is an important part of software QA. Testing internal implementation is unit-testing, which is another part of software QA with a different goal. That’s why you are feeling that people disagree with your approach. Functional testing is important to validate that the system or … Read more

Karate: Is there a http-request hook in karate, that gets called automatically after every API call, and whose behaviour I can modify? [duplicate]

First, I personally think that this is a mis-use of Karate, and you seem to be more interested in reports than actually doing testing. Take some time to think about it. Karate has excellent report integration and you are just wasting your time doing this in my very honest, sincere opinion. No one has asked … Read more

Selenium waitForElement

From the Selenium Documentation PDF : import contextlib import selenium.webdriver as webdriver import selenium.webdriver.support.ui as ui with contextlib.closing(webdriver.Firefox()) as driver: driver.get(‘http://www.google.com’) wait = ui.WebDriverWait(driver,10) # Do not call `implicitly_wait` if using `WebDriverWait`. # It magnifies the timeout. # driver.implicitly_wait(10) inputElement=driver.find_element_by_name(‘q’) inputElement.send_keys(‘Cheese!’) inputElement.submit() print(driver.title) wait.until(lambda driver: driver.title.lower().startswith(‘cheese!’)) print(driver.title) # This raises # selenium.common.exceptions.TimeoutException: Message: None # … Read more

Running Selenium WebDriver python bindings in chrome

You need to make sure the standalone ChromeDriver binary (which is different than the Chrome browser binary) is either in your path or available in the webdriver.chrome.driver environment variable. see http://code.google.com/p/selenium/wiki/ChromeDriver for full information on how wire things up. Edit: Right, seems to be a bug in the Python bindings wrt reading the chromedriver binary … Read more