Sei sulla pagina 1di 27

1.

Selenium doesn't support __________ to write programs (Test Scripts)

a) Java

b) Perl

c) VBScript

d) Python

2. __________ is an Advantage of Selenium WebDriver?

a) Supports Web based Applications only

b) No built-in Result Reporting facility

c) Open Source

d) No IDE

3. In webdriver, which methods navigates to a URL?

a) goToUrl("url")

b) navigate.to("url")

c) getUrl("url")

d) get("url")

4. Which of the following is the correct ‘Webdriver’ command to “delete all cookies in the browser”?

a) Driver.deleteAllCookies()

b) Driver.manage().deleteCookies()

c) Driver.manage().deleteAllCookies()

d) Driver.deleteCookies()

5. In webdriver, which of the following is a valid select statement that selects a value from a dropdown
element?

a) All of the listed options

b) selectByIndex()
c) selectByValue()

d) selectByVisibleText()

6. In webdriver, selectAllOptions() is a valid command.

a) True

b) False

7. In webdriver, which of the following commands retrieves the text of html element?

a) selectText()

b) getText()

c) getElementText()

d) getText(WebElement)

8. In webdriver, which command takes you forward by one page on the browser’s history?

a) navigate.forward()

b) Navigate.forward()

c) navigate ().forward ()

d) Navigate.forward

e) navigate_forward()

9. Consider the following code snippet

WebDriverWait wait = new WebDriverWait(driver, 30);

wait.until(ExpectedConditions.presenceOfElementLocated(by));

This is an example of an implicit wait.

a) True

b) False

10. Which of the following Selenium API enables running Selenium 1.0 tests in web driver?

a) Selenium RC
b) None of the listed options

c) Webdriver

d) WebDriverBackedSelenium

11. In WebDriver, which command can be used to enter values onto text boxes? Select the best answer.

a) type()

b) selenium.type()

c) driver.type("text")

d) sendKeys()

e) sendKeys("text")

12. Which command should be used to ensure Selenium applies wait time for all UI elements in the
script?

a) Explicit wait

b) Fluent Wait

c) Implicit Wait

d) Sleep

13. Which of the following is the correct option to close all the opened browser sessions at one step?

a) Driver.close()

b) Driver.quit()

c) Driver.closeAll()

d) Driver.exit()

14. Which of the following is used to toggle a checkbox in a web form?

a) Element.toggle()

b) Element.click()

c) Element.set()

d) Element.select()
15. Which of the following will terminate the test when the check fails

a) Verify

b) Assert

16. How to switch between windows

a).switchto().window(Integer)

b).switchto().window(string)

c).switchto().window(Array)

d) .switchto().window(array list)

17. Which command to be used to get the text from Alert message popup

a) Alert alert = driver.switchTo().alert();

String message = alert.getText();

b) SwitchAlert alert = driver.switchalert();

String message = alert.getText();

c) Alert alert = driver.switchalert();

String message = alert.getText();

18. Identify the Invalid Xpath for Submit button

a) //*[@class=’submit’]

b) //div[contain(@class,’submit’)]

c) //div[@class=’submit’]

d) //div[contains(@class,’submit’)]

19. Implicit wait time is applied to all elements in your script and Explicit wait time is applied only for
particular specified element.

a) True

b) False
20. In webdriver, which method closes the open browser?

a) quit()

b) terminate()

c) shutdown()

d) close()

21. What is the output of the following statement?

<div> <a id=’name’>Name 1 </a>

<a id=’name’>Name 2 </a></div>

driver.findElement(By.cssSelector(“#name”));

a) Output is Name 1

b) Output is Name 2

c) CSS selector syntax is incorrect

22. Select which are NOT the type of the locaters.

a) ID

b) Name

c) Password

d) Link Text

23. In web driver, what is the method that counts the number of elements?

a) driver.getCountOfElements()

b) driver.findElement(By.id("search")).getCount()

c) driver.findElements(By.i("search")).size()

d) driver.findElements(By.id("search")).length()

24. Identify the correct statement about Implicit Wait-


a) An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find
an element or elements if they are not immediately available.

b) The default setting is 0.

c) Once set, the implicit wait is set for the life of the WebDriver object instance.

d) An implicit wait is the code you define to wait for a certain condition to occur before proceeding
further in the code.

25. Identify the steps to instantiate the Chrome driver in correct sequence

a) 1. Using System Property set method get the path of chrome driver

2. Initialize chrome driver Object with capabilities object as argument

3. Open the URL

4. Set the capabilities of chrome browser

b) 1. Using System Property set method get the path of chrome driver

2. Set the capabilities of chrome browser

3. Initialize chrome driver Object with capabilities object as argument

4. Open the URL

c) 1. Using System Property set method get the path of chrome driver

2. Set the capabilities of chrome browser

3. Open the URL

4. Initialize chrome driver Object with capabilities object as argument

d) 1. Set the capabilities of chrome browser

2. Initialize chrome driver Object with capabilities object as argument

3. Using System Property set method get the path of chrome driver

4. Open the URL

26. Identify the valid command to handle pop ups in chrome browser

a) Alert objAlert = driver.switchTo().alert();); objAlert.accept();

b) driver.findElement(By.id(‘AlertId’)).sendkeys(Keys.Enter);

c) Alert objAlert = new Alert(driver); objAlert.accept();


27. Identify Incorrect URL for Console grid

a) http://localhost:portno

b.http://localhost:portno/grid/console

c.https://localhost:portno/grid/console

28. Select the variation which locates elements by the value of the “name” attribute in Web driver
Selenium

a) By.name

b) By.nametag

c) By.tagname

d) By.nametags

29. Select the Get command which fetches the inner text of the element that you specify in Web driver
Selenium.

a) getinnerText()

b) get_in_Text()

c) get_inner_Text()

d) getText()

30. Consider the following html snippet

• Firefox

• Google Chrome

• Internet Explorer

• Opera

• Safari

Which CSS selector is a valid statement to select Opera?

a) css = li.contains("Opera")

b) css = ul.li(4)
c) css = ul > li:nth-of-type(4)

d) css = ul > li:nth-of-type(3)

e) css = ul.li:nth-child(4)

31. The following codes both print the same value

System.out.println(driver.getTitle());

System.out.println(driver.findElement(By.tagName(“title”)).getText())

a) True

b) False

32. To run a test on Firefox browser, you must have which of the following?

a) Firefox plug-ins are installed

b) Only Firefox browser is installed

c) GeckoDriver is installed, similar to IEDriver and ChromeDriver setup

d) Both GeckoDriver and Firefox browser are installed

33. Identify the correct code snippet to double click an element using selenium from the following:

a) WebElement el = driver.findElement(By.id(“Element”));

Actions builder = new Actions(driver)

Builder.doubleClick().build().perform()

b) WebElement el = driver.findElement(by.id(“ElementID”))

Actions builder = new Actions(driver0;

Buider.doubleClick().build()

c) WebElement el = driver.findElemet(by.id(“ElementID”))

Actions builder = new Actions(driver)

Buider.doubleClick().build()

d) WebElement el = driver.findElement(By.id(“ElementID”)

Actions builder = new Actions(driver)

Builder.doubleClick(el).build()perform()
34. Which of the following is the correct Webdriver statement to retrieve the row count of a Table?

a) All of the listed options

b) Driver.FindElements(By.Xpath(“//table[@id=’tableID’]/tr”)).size();

c) Driver.FindElements(By.Xpath(“//table[@id=’tableID’]/tr”)).getrowcount();

d) Driver.FindElements(By.Xpath(“//table[@id=’tableID’]/tr”)).getcount();

35. Which of the following features are applicable for both Test NG and Junit?

I) Suite Test

II) Group Test

III) Parameterized Test object

IV) Dependency Test

Select One:

a) I, II, III IV

b) I and II

c) I

d) I and III

36. What is the use of Desired Capabilities

a) It is used for Selenium Grid

b) It gives facility to set the properties of browser.

c) It is used to execute multiple test cases on multiple Systems with different browser with Different
version and Different Operating System.

d) All of the above

37. A code snippet related to Fluent wait

Example:

Wait wait = new FluentWait(driver)


.withTimeout(30, SECONDS)

.pollingEvery(5, SECONDS)

.ignoring(NoSuchElementException.class);

1. Ignores NoSuchElementException

2. Automatically adds NoSuchElementException

3. Defines the maximum amount of time to wait for a condition

4. Frequency with which to check the condition

Identify the valid options based on above example

a) Option 1,3 & 4

b) Option 3 & 4

c) Option 2,3 & 4

38. Selenium Framework Component that supports Listener

a) Webdriver

b) TestNG

c) Junit

d) Selenium GRID

39. Identify the Invalid Syntax for Java script executor

a) WebDriver driver = new ChromeDriver();

if (driver instanceof JavascriptExecutor) {

((JavascriptExecutor) driver).executeScript("alert('hello world');");

b) JavascriptExecutor js = new JavascriptExecutor(driver);

js.executeScript("arguments[0].click();", element);

c) JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("arguments[0].click();", element);
40. Identify Invalid Syntax for refreshing the browser

a) driver.findElement(By.id("firstname-placeholder")).sendKeys(Keys.F5);

b) driver.refresh();

c) driver.get(driver.getCurrentUrl());

d) driver.findElement(By.id("firstname-placeholder")).sendKeys("\uE035");

41. Consider the following HTML code snippet

1 2

3 4

driver.findElement(By.xpath(“//table/tr[1]/td”)).getText();

a) The above statement returns 1

b) The above statement returns 3

c) The xpath query is incorrect

d) webdriver statement is incorrect

42. Which method is used when you want to verify whether a certain check box, radio button, or option
in a drop-down box is selected in Web driver Selenium

a) is_Selected()

b) isSelect()

c) isSelected()

d) is_Select()

43. Selenium is compatible with

a) CSS1.0 and CSS 2.0,

b) CSS1.0, CSS 2.0, and CSS 3.0 selectors.

c) CSS 2.0, and CSS 3.0 selectors.

d) CSS1.0, CSS 2.0, CSS 3.0 and CSS 4.0 selectors.


44. Which process use the JavaScript to find an element?

a) By DOM query

b) BY XPath query

c) BY CSS sector

d) All of these

45. To delete a cookie we need to call the deleteCookie method, passing in two parameters.

a) The first parameter is the name of the cookie, and the second parameter is where it was created.

b) The first parameter is where it was created, and the second parameter is the name of cookie.

c) None of these

46. Selects all the parent, grandparent, and so on of the element is related to which axis name in
Selenium:

a) Ancestor

b) Preceding

c) Parent

d) All of these.

47. You have to use ‘Xpath’ to locate the following input element:

<input id=”fk-top-search-box” class=”search-bar-text fk-font-13 ac_input” type=”text”


autofocus=”autofocus” value=”” name=”q” />

Identify the invalid Xpath from the following options.

a) //input[starts-with(@id, ‘fk-top-search-box’) and contains(@class, ‘fk-font-13)]

b) //input[@id=’fk-top-search-box’]

c) //input[starts-with(@class, ”search-bar-text”)]

d) //input[starts-with(@id, ‘top-search-box’) and contains(@class, ‘font-13’)]


48. Select the method which performs a context-click (right click) at the current mouse location.

a) click_Context()

b) context.Click()

c) contextClick()

d) context_Click()

49. The // tells the query that

a) It needs to stop at the first element that it finds.

b) This is comment

c) The path of the file or folder

d) All of these

50. Which of the following API enables running Selenium 1.0 tests in Webdriver

a) Webdriver

b) None of the listed options

c) WebdriverbackedSelenium

d) Selenium RC

Extras 1

1. Can’t configure hub using JSON : False

2. Port number assigned default by HUB -- Option: 4444

3. Under which setting absolute path of chrome driver is set -- Option: browser setting

4. Which command is used to Launch the hub ? java-jar selenium-server-standalone-3.3.1.jar - role


hub
5. Which of the following used for node that our test will run against remote ? -- option: selenium
grid

6. Best coding standard to declare a string variable “name” ? – option : stringname

7. Which of the following code is used to report logs in CRAFT reports ?

8. Which core logic of test case is directly embedded with corresponding script ?

9. In which approach test can be executed multiple set of test data ? data driven framework

10. Which of the following is supported tool by craft/craft lite ? –

option : test cafr/ water / MS VSTS/ ranortex??????

11. What routes selance request from test in selenium grid? – option: selenium hub

12. There should be only one hub in grid? True

13. @before method__will execute method before each test.

14. Test NG must be static ? True

15. Imported package for Test NG is _________ // imported package name.

16. It is possible to skip a @test method from execution ? True

17. What is test NG ? – option: Testing framework

18. Which of following is used with method of test NG ? option: all


19. Which of following is not valid Test NG annotation ? Answer” Data source.

1. where do you verify the test execution results for the test scenario named "test demo"--- results
testdemo

2. in CRAFT/CRAFTLite the default special character to refer the common data from any test data sheet
is--- *

4. how to debug in allocator java file--- debug as

5. under which settings the absolute path of the chrome driver is set--- browser setting

6. CRAFT.file framework best suits when your project is completely owned by automation team which is
well versed with the automation tool and scripting language--- true

7. we can't configure the hub node using JSON--- false

8. which is used to test at scale for large test suites that must be run in multiple environment---
selenium grid

9. which of the following method is used to set the type of browser and operating system that we will
automate---- desired capabilities

10. when does the hub give the following message. A client waiting in queue has given up once it was
offered a new session---- ORPHAN

12. there should be only one hub in grid—true

13. selenium grid suites that specializes in running multiple tests across in parallel--- all 1, 2, 3

14. which method in selenium webdriver is used as a verification method— isenabled()

15. in webdriver which command takes u forward by one page in the browser history--
navigate().forward()
16. in webdriver which of the following command retrieves the text of an html element---
gettext(webelement)

17. selenium locators---

i. identifier
ii. Id
iii. Name
iv. Link
v. DOM
vi. XPath
vii. CSS
viii. UI-element

18. testing cannot handle multiple program or classes--- false

19. what is the correct way to exclude a test in testing----

Annotation @Test (enabled = false)

20. @BeforeGroups

The list of groups that this configuration method will run before. This method is guaranteed to run
shortly before the first test method that belongs to any of these groups is invoked.

21. @BeforeClass

The annotated method will be run only once before the first test method in the current class is invoked.

22. @AfterMethod

The annotated method will be run after each test method.

23. @AfterClass

The annotated method will be run only once after all the test methods in the current class have run.

27. Parallel execution of selenium test cases is possible is testing---- True

28. Default annotations in TestNG---- test


29. Methods for TestNG--- all the listed

Extras 2
1. When the core logic of the test cases is directly embedded within the cross ponding test
scripts. Then, it is called
a) Data driven Approach
b) Hybrid driven Approach
c) Keyword driven Approach
d) Modular driven Approach
2. CRAFT Lite test scripts are organised in
Select one
a) Start, Execute Test, Stop
b) In*****, Execute Test, Break
c) Setup, Execute Test, Break
d) Setup, Execute Test, Tear Down
3. Which function is used to output Intermediate data (Output values) into the specified
data sheet?
a) dataTable.put()….
b) dataTable.getExpec…..()
c) dataTable.getData()
d) dataTable.Setup(Data)

4. Under which setting The absolute path of then chrome drive is set
a) General setting
b) Browser setting
c) Privacy setting
d) Execution setting

5. which is used to test at scale for large test suites that must be run in multiple environment
a) Selenium AC
b) Selenium grid
c) Selenium MG
d) Selenium Web Driver
6. We can use Selenium grid for performance testing
State True or False
a) True
b) False
7. By default, what is the combination of browser testing the node, allowed for ****
users?
a) 3 Firefox, 5 Chrome, 3 Internet Explorer
b) 4 Firefox, 4 Chrome, 3 Internet Explorer
c) 5 Firefox, 5 Chrome, 1 Internet Explorer
d) 5 Firefox, 3 Chrome, 3 Internet Explorer

8. Where does the hub give the following message: The session has been *** because the
node has ***** on the grid
a) Proxy registration
b) Time Out
c) Client_Stopped_Session
d) Browser_TimeOut

9. Default timeout for selenium grid?


Ans: 3000

10. Testing framework allows us to generate test reports in both html and xml—true
11. which language is not supported by selenium

Many languages are supported including C#, Java, Perl, PHP, Python and Ruby

Ans :- Javascript

12. Assertion in selenium web driver

assertEquals
assertNotEquals
assertTrue
assertFalse
assertNull
assertNotNull
(* Above are the assertions in selenium web driver. In question there will be 3 assertions from
the list. So, the answer will be 1,2,3)
13. In TestNG allows user to set dependencies _ True
14. we can priorities for test using TestNG _ True
15. Which of the following is supported tool by Craft/CraftLite tools
a. MS VSTS
b. watir
c. Renorex
d. TestCafe
(Please find the answer)
16 . TsetNg doesnot require main method() to execute :- False

Selenium basics:

Ans: b.

Ans: b.
Ans: driver.quit()

Ans: Explicit wait, fluent wait

Ans: c.

Ans: a.
Ans: d.
Firefox Driver is capable of being run and is tested on Windows, Mac, Linux.

Ans: b.

Ans: all of the listed


Ans: c.

Ans: a.

Ans: b
Ans: c

Ans: a.

------

Ans: a & b.
Ans: implicit

Ans: c

Ans: a)

Ans: d.
Ans: b.

Ans: c

Ans: a
Ans: b and d

Ans: a.

Ans: b.
Ans: d.

Ans: d.

Potrebbero piacerti anche