meethods Flashcards

1
Q

findElement() method

A

a convenient way to locate an element on the web page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

code for findElement()?

A

WebElement findElement(By by)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens if the findElement() does not find the element

A

runtime exception NoSuchElementException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Code for finding list of elements?

A

java.util.List findElements(By by)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

findElements()

A

For finding multiple elements matching the same locator criteria on a web page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens if one element is found? using find elements()

A

if there are multiple WebElements present that satisfy the locating mechanism, all of them are returned to the caller in a list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens if no element is found using findElements()

A

if no element is found, an empty list is returned a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the different ways to find elements?

A

There are 8
ID
Name
ClassName
TagName
LinkText
PartialLinkText
XPath
CSS Selector.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which is faster xpath or css?

A

css selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you get this text?
name = “q”
getting q text
<input></input>

A

use getAttribute() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

getLocation()

A

used to get the relative position of an element where it is rendered on the web page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

getSize()

A

return the width and height of the rendered WebElement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is used to get css? why useful?

A

getCssValue()
This is useful when you want to validate the CSS styles that are applied to your WebElements through your test scripts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What css things can you get with getCssValue?

A

CSS properties can be font-family, background-color, color,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly