HTTP Basic Auth via URL in Firefox does not work?

I have a solution for Firefox and Internet Explorer. For Firefox, you need to go into about:config and create the integer network.http.phishy-userpass-length with a length of 255. This tells Firefox not to popup an authentication box if the username and password are less than 255 characters. You can now use http://user:[email protected] to authenticate. For Internet … Read more

Send keys control + click in Selenium with Python bindings

Use an ActionChain with key_down to press the control key, and key_up to release it: import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get(‘http://google.com’) element = driver.find_element_by_link_text(‘About’) ActionChains(driver) \ .key_down(Keys.CONTROL) \ .click(element) \ .key_up(Keys.CONTROL) \ .perform() time.sleep(10) # Pause to allow you to inspect the browser. … Read more

Catching exceptions from Guzzle

Depending on your project, disabling exceptions for guzzle might be necessary. Sometimes coding rules disallow exceptions for flow control. You can disable exceptions for Guzzle 3 like this: $client = new \Guzzle\Http\Client($httpBase, array( ‘request.options’ => array( ‘exceptions’ => false, ) )); This does not disable curl exceptions for something like timeouts, but now you can … Read more

Best way to take screenshots of tests in Selenium 2?

To do screenshots in Selenium 2 you need to do the following driver = new FireFoxDriver(); // Should work in other Browser Drivers driver.Navigate().GoToUrl(“http://www.theautomatedtester.co.uk”); Screenshot ss = ((ITakesScreenshot) driver).GetScreenshot(); //Use it as you want now string screenshot = ss.AsBase64EncodedString; byte[] screenshotAsByteArray = ss.AsByteArray; ss.SaveAsFile(“filename”, ImageFormat.Png); //use any of the built in image formating ss.ToString();//same as … Read more