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.


							driver.navigate().to("https://google.com)
							
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("matching")
							}
							else{
								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.


							driver.currentUrl
							
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()
    driver.get("https://chercher.tech")
    driver.close()
}
							
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
    driver.get("https://google.com")
}

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
You can also share knowledge by Adding a topic here


Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Recent Addition

new tutorial Selenium Online Training : Our next online training course for Selenium with Java starts from 17th December 2018.

You can attend first 3 classes for free, the total course fee is INR 10,000

The course time would be 8.00 PM(IST) for the first three classes

If you are interested to learn, then you can join the course by sending email to chercher.tech@gmail.com

or Register below


 
Join My Facebook Group
Join Group