Set Rspec default GET request format to JSON
before :each do request.env[“HTTP_ACCEPT”] = ‘application/json’ end
before :each do request.env[“HTTP_ACCEPT”] = ‘application/json’ end
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
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
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
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
Unit tests tell a developer that the code is doing things right; functional tests tell a developer that the code is doing the right things. You can read more at Unit Testing versus Functional Testing A well explained real-life analogy of unit testing and functional testing can be described as follows, Many times the development … Read more