interview questions

How do you open a url without using the get() function in selenium kotlin ?

We can use to() function to open url, to() function opens a web page in the browser window, It allows to a pass a String parameter or URL Type parameter, and its return type is a void.

Check title of web page is "Google"

The title property 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.

We can compare the string using '==' operator

							if(driver.title == "Google"){
								println("not matching")
How do you retrieve the url from a web page ?

The currentUrl property is used to retrieve the URL of the webpage the user is currently opened.

How do you close browser in selenium Kotlin ?

close() function closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the kotlin selenium. close() function does not accept any parameter and returns nothing (yes, return type of nothing).

							fun main(args: Array) {
    val driver = FirefoxDriver()
How do you open browser in selenium Kotlin ?

import org.openqa.selenium.firefox.FirefoxDriver
fun main(args: Array<String>) {
    // Set geckodriver path
    System.setProperty("webdriver.gecko.driver", "C:\\PATH\\geckodriver.exe")
    // Open browser
    val driver = FirefoxDriver()
    // open google

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

You can also share knowledge by Adding a topic here

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions