Search a attribute that contains a word in Selenium RC

Hello,

Today I started post everything that I have learned in the work.

This time I will post the last thing and most usefully command that I learned.

selenium.getAttribute(“id=Element@style“).contains(“display: inline“)

You need to change the bold words, in the first word, you have to change the locator (id, xpath, class, name, link and others). After this you have to change the name of locator respectivally.

Just note that after the locator we have @style this is the attribute in the element that we will catch. Could be @class, or @title, anything and stay in the final of locator separates with @.

In contains, you can change for the tag you need find, like I want the element, whom style contains a display: inline, could be text=’something’ or value=’something’. Like this, simple doesn’t ?

Bye bye 🙂

Selenium RC — Key event, Key pressed

Hello, 

I will post a simple command that simulates a key pressed in the framework selenium RC.

  selenium.keyPressNative(String.valueOf(KeyEvent.VK_TAB));

You have change the bold word for the command of key you want, in the example, we use the Tab command.

It’s simple, you can search for more commands of the keys in the google or another site of search 🙂

Bye bye !

When you have error in certificate in some webpage (Selenium and Java)

Hello, now I will post the command, or better the page that you have to open after of open some page that have an error in the certificate.

In WebDriver you have to open this way:

driver.get(“javascript:document.getElementById(‘overridelink’).click();”);

Send a command in javascript to open the page with the error of certificate.

Bye bye !!

Turn on caps lock in Automation

Hello guys !

This is a simple command to turn on or turn off the caps lock during the automation

  java.awt.Toolkit.getDefaultToolkit()
                                        .setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);

 

You have the change the bold word for on or off 🙂

Ok, that is all !

Bye !