Join us on :

Url Command:

The browser.url(url) command opens the specified URL in the browser instance. The command takes a single string type parameter that is usually a URL of application under test


You might face below error when you use above command no-ftp-get-command-webdriverio

Whenever we pass the website address to the get() method. It first of checks for the protocol in the address, but in the above program we didnot mention any the protocol.

What is protocol ?
Protocol is simple it mention what kind of site is that.

  • http
  • https
  • ftp
  • file
Now let's add the protocol to the URL

									it('Get Command with WebdriverIO', () => {

Get Title:

The getTitle() command is used to retrieve the title of the webpage the user is currently working on. A null string is returned if the webpage has no title. The command doesn’t require any parameter and returns a trimmed string value


Get Current URL Command:

The browser.getUrl() command is used to retrieve the URL of the webpage the user is currently accessing. The command doesn't require any parameter and returns a string value


Get Page Source Command:

The getPageSource() command is used to retrieve the page source of the webpage the user is currently accessing. The command doesn’t require any parameter and returns a string value


Complete code

									it('get page title with WebdriverIO', () => {

Maximize a browser:

In WebdriverIO as we open a browser sometime it may not open on full screen, thus it is a good practice to maximise a browser at time it open.

WebdriverIO provides maximizeWindow() function to maximize the current browser window.


Size & Position of Browser in Webdriver

Sometimes you need to set window position and size or get window size and position. In selenium software test. WebdriverIO software testing tool has many useful methods using which we can play with web browser window for different purpose.

What Is window size and position?

  • Window size means height and width of window.
  • Window position means distance of window from left side(X Coordinates) of screen and top side(Y Coordinates) of screen.

Set Size of window

We can use setWindowSize() function to set the size of window in webdriverio. We can set window width to 400 and height to 500 dimensions using bellow given syntax

									browser.setWindowSize(400, 500)

Get Size of window

We can use getWindowSize() method to get size of window. Below given syntax will return window height and width.

									it('Browser Commands with WebdriverIO', () => {
										browser.setWindowSize(400, 500)

Output of the window size

									{ height: 500, width: 400 }

Set position of the Browser

We can set the postion of the browser window using setWindowPosition

Get position of the Browser

Use getWindowPosition() to get window position.

									it('getWindowPosition Commands with WebdriverIO', () => {
										browser.setWindowPosition(400, 500)

navigateTo(url: string):

navigateTo() function takes the user to given webpage based on the url passed.


WebdriverIO provides back() command to move backwards in the browser's history.


forward() command moves forward in a browser history.


refresh() function refreshes the current webpage in WebdriverIO

									it('Navigation Commands in WebdriverIO', () => {


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