Selenium Tutorial 20: Handling Elements in Selenium Part 2

preview_player
Показать описание
Handling Elements in Selenium Part 2 tutorial explains Handling web elements in Selenium WebDriver, Handle Link, Handle Radio Button, Handle Check box, Handle Web Tables, Handle Drop down box and handle inline elements. Creating Selenium WebDriver Test Scripts using Element locators and WebDriver methods.
Рекомендации по теме
Комментарии
Автор

Class Notes:
Selenium Class 20: Handling Elements in Selenium Part-2

i) Handle Browser
ii) Handle Edit box
iii) Handle Text Area, Error Message, Window Dialog
iv) handle Button

Return/Capture value from Edit box

public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();


}
}

v) Handle Image

Three types of Image elements in Web Environment.

1) General Image (No functionality)

2) Image Button (Submits)

3) Image Link (Directs to another page/location)

Example:

public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();






[2]/center/a/img")).click();

}
}

vi) Handle Link

Operations on Link

> Click
> Check the Link Existence
> Check Enabled status
> Return Link Name etc...

Example:

WebDriver driver = new FirefoxDriver();





[1]/a")).click();
WebElement Gmail_Link =

boolean linkStatus = Gmail_Link.isDisplayed();


linkStatus = Gmail_Link.isEnabled();


String LinkName = Gmail_Link.getText();
System.out.println(LinkName);

Gmail_Link.click();
}
}

vii) Handle Radio Button

Operations on Radio Button

> Select
> Check Enabled status
> Check Displayed status
> Check Selected status

Example:

WebDriver driver = new FirefoxDriver();


WebElement maleRadioButton =

boolean elementStatus =






maleRadioButton.click();


}
}

viii) Handle Drop Down box

Operations on Drop Down Box

> Select an Item
> Check Displayed status
> Check Enabled status
> Items count

Example:

public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();


Select dropDown = new Select
an item by index


List<WebElement> e = dropDown.getOptions();
int itemsCount = e.size();

}
}

ix) Handle Check box

Operations on Check box

> Select
> Unselect
> Check Displayed status
> Check Enabled status
> Check selected status

Example:

WebDriver driver = new FirefoxDriver();


[2]")).isDisplayed());//true



[2]")).isEnabled());//true



[2]")).isSelected());//false





[2]")).isSelected());//true





[2]")).isSelected());//false

x) Handle Web Table / HTML Table

Operations on Web Table:

> Get cell value
> Rows Count
> Cells Count

Example:

WebDriver driver = new FirefoxDriver();

[2]")).getText();
System.out.println(s);
WebElement htmlTable =

List <WebElement> rows =
int r = rows.size();
System.out.println(r);

List <WebElement> cells =
int c = cells.size();
System.out.println(c);

xi) Handle inline Elements

The span tag is used to group inline Elements in a Document.

Example 1:

WebDriver driver = new FirefoxDriver();
driver.navigate().back();

Example 2:

WebDriver driver = new FirefoxDriver();


Handle Frames
Handle Mouse Over
Working with Multiple browser windows.

gcreddy
Автор

Couldn't stop from appreciating the way you explain...simple, easy, understandable.

estherjesudass
Автор

Sir I keeps watching all your videos. Your way of teaching and explaining each concept is really superb....Thank you so much.

mahizhang
Автор

The way you explain is awesome sir. Thanks a lot for videos

himanigupta
Автор

awesome way of teaching excellent job sir i really appreciate you

hamidsiddiqui
Автор

Hi sir thank you for the videos while using dropdown i got some error message can you help me
Exception in thread "main" Cannot locate option with index: 2

psrikanth
Автор

Thank you Sir, step to step understandable!

manishkadam
Автор

Hi sir.. I am using Selenium on salesforce pages.. My requirement is.. There is a lookup icon which is non-editable field, when we click on the lookup icon it will open new window.. In newly opened window I have to enter one some values to search.. And selecting some values in newly opened window.. Automatically the newly opened window will close.. Could you please help me how to handle these scenarios

tharaka
Автор

Thanks for sharing your knowledge, sir. Appreciated :)

sahillambaa
Автор

thank you for the wonderful videos sir. request you to kindly share the notes for this class

rahulk
Автор

Video is really gud.. learning many things

priyankadubey
Автор

Sir, please let me know how to scroll up and down using selenium

subhashreepriyadarshini
Автор

Sir, When I am working on inline elements, when i use this, it is going to 'About Google Products', I wonder why.

sumanpalisetty
Автор

Thanks for sharing the informative videos sir, can you please upload nots,

shahidmahmood
Автор

Hello Sir. can you please share us the HTML examples to practice?. Example HTML table, multiple check boxes etc. thanks

lipsarani
Автор

Sir I am trying to automat Gmail login but can't able to locate password block.
Please help me to locate

Rd_
Автор

I am facing this issue while selecting from drop down list
Selenium 3.0
Firefox-47
eclipse nenon3


code:
/* WebElement dropDownListBox
dropDownListBox.click();

Select secondDrpDwn = new Select(dropDownListBox);



*/

error:


Cannot locate element with text: streaming
Build info: version: 'unknown', revision: 'b526bd5', time: '2017-03-07 11:11:07 -0800'

Driver info: driver.version: unknown
at
at
at Method)
at

sasmitapadhi
Автор

sir.How to handle gmail compose button?

kumarraviranjan
Автор

how we can minimize the page in selenium ???

engineer_poonam