Skip to main content

Posts

Showing posts from January, 2012

“Document Not Saved” error in Excel

Its so common that we convert an excel to a PDF. It happens almost everyday for me. It was recently that I got to see the error “Document Not Saved” while converting an excel to a PDF file. Here are the steps which helped me resolve the issue: Step 1: Check for your permissions – Many of the times, a shared file might restrict saving the file into other forms. In this case, get the proper permissions for yourselfStep 2: You have embedded objects in your excel (MS Support Link)If you do, then the workaround is to remove the embedded objects and try saving the file againIf you don’t know anything about the existence of embedded objects just like I do, then perform the following steps Use the Go To option from the Edit menu or use the keyboard shortcut Ctrl + G to open the Go To dialog box. Click on Special. Select Objects in the Special dialog box. Click Ok. This will highlight all the embedded objects on the excel file – now you can delete them Picked up the above information from t…

Working with File Path Separators

Something I learned very recently. 


Have you ever written code which involved file path's? If yes then this post might be helpful...Even otherwise knowing something unknown or brushing up concepts known won't hurt - would they? :)


So here I go, I have my Selenium Scripts which might run on both Linux and Windows machines. I don't store my test files on a central location which can be accessed over the network/internet, so when my script runs on a Linux machine it would look locally on the linux file system for the test files. Same is the case when I run my tests on Windows. 


Here is what I used to do :) 


My Initial Approach: 


If (Test_Running_On_Linux){

return System.getProperty("user.dir")+"/"+TestProperties.strFilePathPart1+ "/"+ TestProperties.strFilePathPart2;
}
else if(Test_Running_On_Windows){

return System.getProperty("user.dir")+"\\"+TestProperties.strFilePathPart1+ "\\"+ TestProperties.strFilePathPart2;
}


Now what i…

How to check if my xpath is valid using firebug?

Yes, you can verify if your xpath is pointing to the right source on the web application under test using FireBug. Here is how: 


Go to the Web Application under test We'll take Google for simplicity reasons
Open FireBug - Go to the Console Console can also be seen at the bottom of the page, so don't worry they both are the same. They can be switched as follows: 


Type in $x("Your xpath here") on the command line prompt as shown below:

Hit Enter/RunYou will get to see the element which was filtered out with your XPath expression

Selenium Exception: java.lang.RuntimeException: Could not start Selenium session

You have a simple Java Selenium Code. All of it looks perfect :) except for when you try running it, it fails miserably again and again with an exception: 



java.lang.RuntimeException:Could not start Selenium sessionThe possible solutions for the above issue can be the following: You repeated the "selenium.start()" issue - Looks like if we create a webdriver first and then create a selenium object thereafter, an internal issue arises with the selenium server where it fails when we use selenium.start() So if you are wondering on how to solve - Use selenium.open() instead

Useful Linux Commands - III

To know your hostname typehostnameTo know the shell we are working inps -p $$This command would give a result:PID TTY          TIME CMD15362 pts/3    00:00:00 zshecho $SHELLThis command would give a result like: /bin/zshPlease note that once you export your PATH variable or any other env variable, you should restart your terminal to see the changesTo create links between the files we can use "ln"To view the current processes which are Running: ps -ef | moreTo find out how much free memory (RAM) we have on our linux box:freeThis command will give the used, swap, free memory on our linux boxAlso the output is in bytesfree -gThis command will give the used, swap, free memory on our linux box in GB'sTo find out the disk space usage data: df -k This commands gives output in bytesdf -h This gives the output in GB's