Rip's Domain

Selenium and ElementNotVisibleException: One rule to keep yourself from going insane

Posted in Uncategorized by rip747 on April 5, 2014

I’m working on a project using Selenium and C#. Though really cool as hell, I have to say its nothing short of frustrating.

Take for instance the following error:

OpenQA.Selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with.

That little error took me an hour to figure out why it was happening. For some reason I would get this error when I was running my console app by double clicking on it, however i wouldn’t get the error when launching it through a schedule task.

The issue turned out to be something I completely overlooked and probably a golden rule when using Selenium:

“If you can’t see it, Selenium can’t click it”

So what doesn’t that mean exactly? In other words when I was running my application by launching it myself; firefox would open, go to the page and Selenium would attempt to click a button on the page. Turns out that even though the button was “physically” on the page, it was covered by some stupid static overlay hugging the bottom of the screen because of the window size. I only figured it out after I paused Selenium (using Thread.Sleep(5000);)  and manually scrolled the page down so I could physically see the button myself in the browser window.

Now it all made sense why everything was blowing up when I was running the application myself, but it would work fine through a scheduled tasks. I’m guessing through a schedule task, the browser is invoked headless so this whole “physically seeing” elements and browser window size doesn’t apply. Selenium must just see the page as whole since it doesn’t have the restriction of the browser window.

In the end, the way I got it all to work by forcing the page to scroll to the bottom using the IJavaScriptExecutor like so:

IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
jse.ExecuteScript(“window.scrollTo(0, document.body.scrollHeight);”);

 

By default, Selenium will automatically scroll the window to the element in order to make sure that it is visible in the browser window, however, because of this overlay, it actually needed to scroll about 100px more down the page in order for the element to actually be visible in the browser. Scrolling to the bottom was a hack, but it worked.

cfindex: Warn E0-1514 (Drvr): TstrIOFilter:flt_kv: KV failed on filtering document: error = 8 on PDFs

Posted in Uncategorized by rip747 on December 3, 2013

Solved this problem by removing a “PRINT FORM” button that would automatically print the form when hovered on

cfindex: Warn E0-1514 (Drvr): TstrIOFilter:flt_kv: KV failed on filtering document: error = 6 when indexing PDFs

Posted in Uncategorized by rip747 on December 3, 2013

What solved this issue for me was removing any security the PDF had on it. In this case the PDF has password security enabled

Oracle 11g and SSIS error: cannot convert between unicode and non-unicode string data types

Posted in MSSQL, Oracle by rip747 on August 19, 2013

When upgrading our Oracle database to 11g we received the following error when executing previously working SSIS packages on our MSSQL2008R2 server:

Executed as user: <redacted> Microsoft (R) SQL Server Execute Package Utility Version 10.50.1600.1 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 3:10:34 PM Error: 2013-08-16 15:10:37.14 Code: 0xC02020F6 Source: <redacted> OLE DB Source [1] Description: Column “<redacted>” cannot convert between unicode and non-unicode string data types. End Error Error: 2013-08-16 15:10:37.15 Code: 0xC004706B Source: <redacted> SSIS.Pipeline Description: “component “OLE DB Source” (1)” failed validation and returned validation status “VS_ISBROKEN”. End Error Error: 2013-08-16 15:10:37.15 Code: 0xC004700C Source: <redacted> SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2013-08-16 15:10:37.15 Code: 0xC0024107 Source: <redacted> Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 3:10:34 PM Finished: 3:10:37 PM Elapsed: 2.308 seconds. The package execution failed. The step failed.

Turns out the fix was very simple. Basically all we had to do was edit the package in notepad and replace all occurrences of:

validateExternalMetadata=”True”

to:

validateExternalMetadata=”False”

500 error in IIS7 with ColdFusion and huge form posts or coldfusion.filter.FormScope$PostParametersLimitExceededException: POST parameters

Posted in ColdFusion by rip747 on July 19, 2013

Last night I was bitten by exceeding the parameter limit on form posts with Coldfusion (9.02), here within abbreviated as ACF. Basically if you installed the 9.02 CHF 1 or installed security hotfix APSB12-06 on an earlier version of ACF, it will restrict your form post to 100 fields. Why they think this is a good security measure is beyond me, but that’s what it does

Anywho, the issue is that you OBVIOUSLY know don’t if you’re going to run into the 100 field limitation until your clients start calling you because they are receiving a 500 error. The bad part about this, is that the error happens at the IIS level so the request never even gets to ACF, hence you wouldn’t receive an error email from ACF if you had that setup (you do have ACF emailing you when errors occur, correct?)

The work around is simple though, and is described in another security hotfix (APSB12-15). Basically you open the neo-runtime.xml file, find the following line:

<var name=’postSizeLimit’><number>100.0</number></var>

and add the following right after itL

<var name=’postParametersLimit’><number>10000.0</number></var>

BTW, you can make that number whatever you want. I choose 10,000, because well, why not.

Then restart ACF and everything should be cool… right? WRONG!

Even after I did this, I still got the 500 error. After like an hour, I decide to open up the neo-runtime.xml file again and did a search for `postParametersLimit`. Guess what, not only was the line that I added in there, but there was a second instance of the line somewhere in the middle of the file. Now I didn’t put it in there, so I’m wondering if maybe it was included in the ACF 9.02 version I downloaded already. Whatever. I just removed the second instance and everything is working now.

Android: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

Posted in Uncategorized by rip747 on April 5, 2013

When trying to launch our android application onto the emulator through eclipse, i get the following error:

04-05 15:12:24.082: E/AndroidRuntime(386): FATAL EXCEPTION: main

04-05 15:12:24.082: E/AndroidRuntime(386): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.sheriff/org.sheriff.BizTownActivity}: java.lang.ClassNotFoundException: org.sheriff.BizTownActivity in loader dalvik.system.PathClassLoader[/data/app/org.sheriff-2.apk]

04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread.access$500(ActivityThread.java:122)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.os.Looper.loop(Looper.java:132)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread.main(ActivityThread.java:4123)
04-05 15:12:24.082: E/AndroidRuntime(386): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 15:12:24.082: E/AndroidRuntime(386): at java.lang.reflect.Method.invoke(Method.java:491)
04-05 15:12:24.082: E/AndroidRuntime(386): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-05 15:12:24.082: E/AndroidRuntime(386): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-05 15:12:24.082: E/AndroidRuntime(386): at dalvik.system.NativeStart.main(Native Method)
04-05 15:12:24.082: E/AndroidRuntime(386): Caused by: java.lang.ClassNotFoundException: org.sheriff.BizTownActivity in loader dalvik.system.PathClassLoader[/data/app/org.sheriff-2.apk]
04-05 15:12:24.082: E/AndroidRuntime(386): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
04-05 15:12:24.082: E/AndroidRuntime(386): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
04-05 15:12:24.082: E/AndroidRuntime(386): at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
04-05 15:12:24.082: E/AndroidRuntime(386): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
04-05 15:12:24.082: E/AndroidRuntime(386): … 11 more

 

After searching through StackOverflow and Google. I couldn’t come up with an answer. For some reason I had a look at my .classpath file and noticed something:

<?xml version=”1.0″ encoding=”UTF-8″?>
<classpath>
<classpathentry kind=”src” path=”gen”/>
<classpathentry kind=”con” path=”com.android.ide.eclipse.adt.ANDROID_FRAMEWORK”/>
<classpathentry kind=”con” path=”com.android.ide.eclipse.adt.LIBRARIES”/>
<classpathentry kind=”output” path=”bin/classes”/>
</classpath>

If you look closely you’ll notice that there isn’t a classpathentry for src directory itself where org.sheriff.BizTownActivity is located. I changed the .classpath to reflect the src path:

<?xml version=”1.0″ encoding=”UTF-8″?>
<classpath>
<classpathentry kind=”src” path=”src”/>
<classpathentry kind=”src” path=”gen”/>
<classpathentry kind=”con” path=”com.android.ide.eclipse.adt.ANDROID_FRAMEWORK”/>
<classpathentry kind=”con” path=”com.android.ide.eclipse.adt.LIBRARIES”/>
<classpathentry kind=”output” path=”bin/classes”/>
</classpath>

and it worked!!!

Tagged with:

Disable the github issue tracker. Use pull requests instead?

Posted in Opensource by rip747 on January 7, 2013

Why is it that github even has an issue tracker? Doesn’t it make more sense to have bug reports and enhancement requests submitted through pull requests?

Think about it for a moment:

How many times has someone filed a bug report giving you little or unclear information. Now you have to waste your time trying to contact the person to get more specific information. This could have been totally avoided if the person would have written a failing test demonstrating the bug in the first place.

How many enhancement requests have you’ve gotten that, though seemed like a good idea, required an enormous amount of effort or was something that a single person needed. Why didn’t the requester take the time to code the enhancement so as to not consume the time of the project author(s)?

As an experiment I’m going to do this with the new project I’ve started. I’m hoping that by removing the issue tracker it will encourage more people to step out of their comfort zone and participate.

Tagged with: , , ,

ColdFusion 9 64-bit / IIS7.5 / Windows 7 / 500 error

Posted in Uncategorized by rip747 on December 23, 2012

Quick note about setting up ACF9 on Windows 7 and IIS 7.5. In order to get everything working, you need to install the following:

http://download.macromedia.com/pub/coldfusion/cf9_installer/ColdFusion_9_WWEJ_win64.exe

http://download.macromedia.com/pub/coldfusion/updates/901/ColdFusion_update_901_WWEJ_win64.exe

http://helpx.adobe.com/coldfusion/kb/cumulative-hot-fix-2-coldfusion-1.html

In other words, you need to install the base install, the CF 9.0.1 update and the CF 9.0.1 Hot Fix 2. The Hot Fix is probably the most important as if you only install the base and then the update, you will receive a 500 error when trying to access any site running CF especially the CF Administrator.

ASP.net MVC images from virtual directory

Posted in ASP.net MVC by rip747 on September 25, 2012

Here is something that stumped us for a while. At work we were converting a legacy asp site over to ASP.net MVC. The old site got it images from two virtual directories mapped to a file share on another server. When we went to deploy the new site, we created the virtual directories, however we kept on getting ASP.net error when trying to access any of the images!

Turns out that in order to use a virtual directory under as ASP.net MVC application, you need to make sure that after you create the virtual directory, you convert it to an application.

Apparently without doing this, IIS thinks that the virtual directory is part of the ASP.net MVC application and when requests to the virtual directory come it, the ASP.net MVC routing takes over which was causing the error. By converting it to an application, you remove the virtual directory from the ASP.net MVC application entirely.

RailsTutorial.org problems

Posted in Uncategorized by rip747 on June 2, 2012

below are some of the problems I’ve been having while following the railstutorial.org screencasts. These are in no particular order and may only pertain to my system, but I thought that I would document them here in case others run into them. Also, I’m going by the information that is provided in the screencasts themselves. During the screencasts, there are several time where the author refers to the online book in order to get the proper configuration. Most people are not going to take the time to search through the book to get the proper configuration to follow along in the screencasts. Hopefully this post will help people along when following the screencast and prevent them from having to refer to the book.

Lesson 1

when pushing to heroku, you will receive the following error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Try ‘port install sqlite3 +universal’
or ‘yum install sqlite-devel’ and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

basically this means that heroku couldn’t compile the sqlite gem. You Gemfile should have the following in it if you’re following along:


source 'https://rubygems.org'

gem 'rails', '3.2.5'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
 gem 'sass-rails', '~> 3.2.3'
 gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
 # gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

To fix, you need to make it so that the sqlite gem is not installed in production. to do this add change the `gem ‘sqlite3′` line in your Gemfile to the following:


gem 'sqlite3', :group => [:development, :test]

Lesson 3

When running the tests from with ruby you receive the error `/bin/sh: rspec: command not found` Basically this is cause because you having started SublimeText from the command line and don’t have `~/bin` in your path. To add `~/bin` to your path open up your .bash_profile file in an editor. WARNING! During the installation tutorial, you installed RVM so that you can manage your ruby installation. This causes a major problem because creating a `.bash_profile` to allow you to edit your path will cause rvm to break, which will result in rails to break. In order to prevent this, YOU MUST run the rvm script from within your `.bash_profile`. Below is a fixed path and script for your .bash_profile:

export PATH=/opt/local/bin:/opt/local/sbin:$HOME/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Depending on the installation of your system, your path could contain a bunch of stuff. Don’t worry what it looks like, just make sure you add `$HOME/bin` to the end. Now close and reopen the Terminal. Next follow the instructions here to link the `subl` executable to by issuing the following command in the Terminal window:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

After that, you should be able to open SublimeText from a command prompt by doing `subl .`

subl .

Now when you run RubyTests it will be able to find rspec and work.

Lesson 10

The css for the micropost is located at Listing 10.24.

Follow

Get every new post delivered to your Inbox.