Join us on :

WebdriverIO Questions

Select a Checkbox using WebdriverIO ?

We need to follow few steps to make sure that element is selected or not, Normally when we have this kind of scenarios what we do is, we will use click() method to select the check box. After this we might mover on to next step of scenario.

Sometimes not selecting will help you, you got to make sure that the checkbox is selected. To verify it we need to use the isSelected() method and get check whether it is really selected.

									var checked = $("//input[@type='checkbox']").isSelected()

How can we find all the links on a web page using WebdriverIO?

All the links are formed using anchor tag a and all links will have href attribute with url value. So by locating elements of tagName 'a' we can find all the links on a webpage.

We can use following code to get all the links


How to verify tool tip text using WebdriverIO ?

Tool tips web elements have an attribute of type title. By fetching the value of 'title' attribute we can verify the tool tip text in WebdriverIO.

										var tooltip = $("some locator").getAttribute("title")

How to check whether a dropdown is selected or not in angular applications with webdriverIO ?

For testing angular application, we would be using protractor browser automaton tool.
isSelected() verifies if an element is selected or not, isSelected() method returns boolean value, true if the element is selected and false if it is not.

var selectedFlag = $("//input[@id='selected'] [value='Bangalore']").isSelected()
console.log("Is element selected : "+selectedFlag);

How do you accept alert in WebdriverIO ?

We can accept the alert using acceptAlert()


How to Overwrite Current Input Value in editable field On Page using WebriverIO ?

The sendKeys method on WebElement class will append the value to existing value of element. If you want to clear the old value. You can use clear() method.

let webElement = $("element-id");
webElement.setValue("new input value");		

About Author

Article is written by Pavan (a) KarthiQ. Well, I am serving notice period in an MNC, Bangalore. I thought to enrich every person knowledge a little, I always have a feeling, when we teach something, we will learn more than what you know. Knowledge is the only thing that doubles when you spend it.

I have also created the reporter for Protractor Jasmine. Use for your projects without any hesitation

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions