11) How do I pause my test execution for fix 20 seconds at specific point?
If you wants to pause test execution for 20 seconds then you can use java.lang.Thread.sleep(long milliseconds) method in your test.
Thread.sleep(20000);
12) What is the alternative driver.get() method to open URL In browser?
driver.navigate().to()
13) How to set browser window size to 600(Width) X 400(Height)?
driver.manage().window().setSize(new Dimension(600,400));
14) Whats the use of "submit" method In selenium WebDriver?
The submit method is used to submit the form. Example: After filling all the information, we can call submit method to submit registration form or LogIn form or submitting Contact Us form.
The submit button should be located inside <form> tag and button's type tag's attribute should be submit then submit method will work.
15) While running test case on firefox or chrome driver, it Is not showing me any bookmarks, addons, saved passwords etc. in that browser. Do you know why?
When you run the browser manually, it loads with bookmarks, addons, passwords etc. which are saved in your browser's profile folder.
When you run browser through selenium webdriver, it is opening new browser instance with blank or new profile. So it will not show you bookmarks and all those things in that browser Instance.
You can create custom firefox profile and then you can use it In selenium webdriver test.
16) Give me any five different xPath syntax to locate bellow given Input element.
<input id="fk-top-search-box" class="search-bar-text fk-font-13 ac_input" type="text" autofocus="autofocus" value="" name="q" />
//input[@id='fk-top-search-box']
//input[contains(@name,'q')]
//input[starts-with(@class, "search-bar-text")]
//input[@id='fk-top-search-box' or @name='q']
//input[starts-with(@id, 'fk-top-search-box') and contains(@class,'fk-font-13')]
17) How to type text in text box or text area?
driver.findElement(By.name("fname")).sendKeys("My First Name");
18) How to get page title?
driver.getTitle();
19) How to get Current Page URL?
driver.getCurrentUrl();
20) How to get domain name using java script executor?
JavascriptExecutor javascript = (JavascriptExecutor) driver;
String CurrentURLUsingJS=(String)javascript.executeScript("return document.domain");
<-- Previous || Next -->
If you wants to pause test execution for 20 seconds then you can use java.lang.Thread.sleep(long milliseconds) method in your test.
Thread.sleep(20000);
12) What is the alternative driver.get() method to open URL In browser?
driver.navigate().to()
13) How to set browser window size to 600(Width) X 400(Height)?
driver.manage().window().setSize(new Dimension(600,400));
14) Whats the use of "submit" method In selenium WebDriver?
The submit method is used to submit the form. Example: After filling all the information, we can call submit method to submit registration form or LogIn form or submitting Contact Us form.
The submit button should be located inside <form> tag and button's type tag's attribute should be submit then submit method will work.
15) While running test case on firefox or chrome driver, it Is not showing me any bookmarks, addons, saved passwords etc. in that browser. Do you know why?
When you run the browser manually, it loads with bookmarks, addons, passwords etc. which are saved in your browser's profile folder.
When you run browser through selenium webdriver, it is opening new browser instance with blank or new profile. So it will not show you bookmarks and all those things in that browser Instance.
You can create custom firefox profile and then you can use it In selenium webdriver test.
16) Give me any five different xPath syntax to locate bellow given Input element.
<input id="fk-top-search-box" class="search-bar-text fk-font-13 ac_input" type="text" autofocus="autofocus" value="" name="q" />
//input[@id='fk-top-search-box']
//input[contains(@name,'q')]
//input[starts-with(@class, "search-bar-text")]
//input[@id='fk-top-search-box' or @name='q']
//input[starts-with(@id, 'fk-top-search-box') and contains(@class,'fk-font-13')]
17) How to type text in text box or text area?
driver.findElement(By.name("fname")).sendKeys("My First Name");
18) How to get page title?
driver.getTitle();
19) How to get Current Page URL?
driver.getCurrentUrl();
20) How to get domain name using java script executor?
JavascriptExecutor javascript = (JavascriptExecutor) driver;
String CurrentURLUsingJS=(String)javascript.executeScript("return document.domain");
<-- Previous || Next -->
No comments:
Post a Comment