Fix Inconsistent JS Selenium Tests with element.isEnabled()

I’ve been writing automated regression tests at work over the past month, using Jest and Selenium WebDriver, and have really been struggling to get my tests to pass consistently. I began to suspect that methods like wait(until.elementIsVisible... and wait(until.elementTextIs... did not actually do what I expected since I was getting so many inconsistent failures. I began searching for a way to determine if an element is clickable with Selenium WebDriverJS. This is possible in other languages (I think Python and Java at least), but it’s not available for JavaScript. But it turns out you can make it work. Continue reading

Advertisements

Project Euler 13

This one was a bit confusing.  The wording of the problem is, “Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.”  I assumed that they wanted the ones place through the billionths place, but they wanted the first ten digits starting from the left side of the number. Continue reading

Project Euler 14

I haven’t written any code in almost 2 weeks, but I did read a few pages of Eloquent Javascript (I highly recommend it, along with Javascript: The Good Parts).  I started Euler 14 on 7/30, felt a bit overwhelmed, wrote a rough sketch, and left it.  I felt inspired tonight (read: nothing else to do) so I revisited the problem.   Continue reading

Project Euler 11

I just finished this one.  My code is incredibly huge, over 100 lines.  I’ve seen a few solutions that were far shorter than mine, but I found the answer.  It took me a half hour to realize this, but for those who are trying to solve this and are stuck, don’t forget to check the correct diagonal directions.  I was checking diagonally down from left to right, and then checking diagonally up from right to left, which is the exact same thing.  That produced the exact same results, so I had to change one of those checks.

Here are a couple other hints, that most of you probably understood right away: Continue reading

Inserting dates in increments of X, based on dates in other cells

 I’m working with an old spreadsheet that has nearly 1500 rows of data.  This spreadsheet has been in existence since late 2009 and has been maintained by several different people, with no one providing Excel-minded, future-proofing leadership to unify what they were maintaining and how they were maintaining it.  As such, the data is incomplete and dirty.  Here’s how I fixed over 300 empty cells with estimated expiration dates within a few minutes (it can be done much quicker if you know exactly what you’re doing). Continue reading