Wednesday, April 17, 2013

Object Lock error in HP ALM (QC)

If you get an Object Lock error in QC ("Object locked by 'username' ") here are the steps to solve it:

1. Go to Site Administration.
2. Search for the corresponding Project.
3. Find the LOCKS table.
4. Execute following script:
DELETE FROM LOCKS WHERE LK_USER = 'username'


Saturday, December 8, 2012

How to execute Compound class names using WebDriver

If you have a Compound class and you want to do something like this:
IWebElement elem = Browser.Driver.FindElement(By.ClassName("name1 name2 name 3"));

you will get an error like:
"Compound class names are not supported. Consider searching for one class name and filtering the results."

The solution:
Use CssSelector, and put "." in front of each name, like this:
IWebElement elem = Browser.Driver.FindElement(By.CssSelector(".name1.name2.name 3"));

Remove utorrent toolbar from Chrome

If you have this annoying problem here is how to fix it:

1. Go to C:\Users\[Username]\AppData\Local\ and remove CRE and Conduit directories.
2. Start -> regedit -> search for '\AppData\Local\CRE' and remove any related Extensions.


Wednesday, November 28, 2012

For Chrome Devtools

Here are some useful tips for Chrome Devtools.
I got this from one of my coleagues. Thanks Calin :)

http://anti-code.com/devtools-cheatsheet/

Have fun!

Tuesday, November 20, 2012

Selenium Server Setup

Steps to Setup Selenium Server:

1. Download and Install Java if not available.
http://www.java.com/en/download/index.jsp

2. Download Selenium Server.
http://seleniumhq.org/download/


3. Open Command Prompt in Selenium Server location and run the following command:
java -jar "selenium-server-standalone-2.25.0.jar"



4. In VisualStudio:

IWebDriver driver = 
new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"),
                    DesiredCapabilities.Firefox());              

Get XPath using Firefox Firebug

If you need XPath here are 3 simple steps to get it.

1. Open desired page in Firefox (that has Firebug AddOn).

2. Right-click on page element and select Inspect Element with Firebug:


3. Right-click on inspected element and select Copy XPath:


Selenium Webdriver Basics

Some basic Selenium WebDriver stuff:

1. Click a RadioButton:
var radioButton = driver.FindElements(By.Name("colorname"))[0];
radioButton.Click();

2. Get a RadioButton value:

var radioButtons = driver.FindElements(By.Name("colorname"));
foreach (var radioButton in radioButtons)
{
  if (radioButton.Selected)
    Console.WriteLine(radioButton.GetAttribute("value"));
}

3. Check Checkbox:
var checkBox = driver.FindElement(By.Id("checkboxId"));
checkBox.Click();

4. Select from dropdown list:
var select = driver.FindElement(By.Id("elementId"));
var option = select.FindElemets(By.TagName("optionTagName"))[0];
option.Click();

5. Get text row from table:
var table = driver.FindElement(By.TagName("table"));
var row = table.FindElements(By.TagName("td"))[0];
Console.WriteLine(row.Text);

6. Get element using XPath:
var element = driver.FindElement(By.XPath("//*[@id="gbqfq"]"));


7. Implicit waiting:
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));


8. Explicit waiting:
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var element = wait.Until(d=>
              {
                   return driver.FindElements(By.ClassName("class"))[0];
               });
element.Click();