Skip to main content

Posts

Showing posts from 2015

Ludum Dare 33

My Entry for Ludum Dare 33 http://ludumdare.com/compo/ludum-dare-33/?action=preview&uid=34284

Selenium waits

WebDriver driver = new ChromeDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); //explicit wait - wait given a timeout time WebDriverWait webDriverWait = new WebDriverWait(driver, MAX_WAIT_TIME); webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(GRID_TITLE_XPATH))); //fluent wait - wait given a timeout time and polling interval public WebElement fluentWait(final By locator) { Wait wait = new FluentWait (driver) .withTimeout(30, TimeUnit.SECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(org.openqa.selenium.NoSuchElementException.class); //Can also use functions from ExpectedConditions class such as ExpectedConditions.visibilityOfElementLocated(By locator) WebElement element = wait.until(new Function () { public WebElement apply(WebDriver driver) { return driver.findElement(locator); } }); return element; }; WebElement e = flu

CoderByte Array Addition I

I started playing around with coderbyte a place to test your programming skills. I was stumped for a bit on this question Array Addition I: "Using the JavaScript language, have the function  ArrayAdditionI( arr )  take the array of numbers stored in  arr  and return the string  true  if any combination of numbers in the array can be added up to equal the  largest number  in the array, otherwise return the string  false . For example: if  arr contains [4, 6, 23, 10, 1, 3] the output should return  true  because 4 + 6 + 10 + 3 = 23. The array will not be empty, will not contain all the same elements, and may contain negative numbers.  Use the  Parameter Testing  feature in the box below to test your code with different arguments." But eventually hammered it out. I saw some people using multiple for loops as well as nested loops. I took a different approach and just did math with the exception of one for loop. Here is my code example with assertions if you anyone is inte