0% found this document useful (0 votes)
5 views

Selenium Script NOTES

selenium script
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Selenium Script NOTES

selenium script
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Selenium Scripts

1.how to open chrome,edge or fireox browser then open url get the title of page, and get
the url of page

Output for title and url

2.Navigation command- how to maximize,minimize window also how to go forward and backward from one page to another

3.how to pass values in text box or log in in website


4.how to read values that is loactors value eg. login button having id with value login (read_value)

Output:

5.how to check if the element is displayed/selected/enabled or not(Conditional command)

It provides true or false ans


6.how to handle drop down

To find out number of drop down options available we use following statement

How to print text from web page

7.how to handle alert


8.how to switch from one frame to another(iframe)
>>
An iFrame, also knowns as Inline Frame, is an element that loads another HTML element inside of a web page. They are
commonly used to embed specific content like external ads, videos, tags, or other interactive elements into the page

8.how to switch the window or how to get to new window(Multiple winow)

Suppose we have open following websites and now I want to open particular website lets say Facebook how will you switch
between windows without using index

Facebook.com
gmail.com
amazon.com
flip-kart.com
Credence.com

Here we have used title to match with all handles whichever handle matches the title our required window will open .

9. how to use implicit wait or when to use implicit wait


10. 10.how to use explicit wait or when to use explicit wait

We use condition to wait the driver for particular given time.

Diff bet implicit and explicit is that when we apply implicit wait it applies to all element where as in the case of explicit wait is
used to apply for particular element

Exception: Implicit wait throws a NoSuchElementException


explicit wait throws a TimeoutException when the element doesn't meet the condition within the specified timeout.

11.how to scroll page

Action chains
11. how to handle hover drop down and select option out of it

How to use right click and double click on mouse

How to use drag and drop

Q.12 table operation


Print values from table present on website\html page

tr[1]/th[1] means 1st row 1st column value from the table

How to check how many rows and columns are there in table
Here functionn of len and --lene--() is same

Q14.screenshot

Q15..excel operations
Q15.logging

Or

Q16.DAY PICKER BY USING DROPDOWN

BY using loop
Here we get calender and we need to go through years and moths so in such case we use for loop method is shows below

Xpath for element departure

Q.how to upload file from local pc?


>>similar to how we use send_keys to provide input value instead provide path of the file

Q. How to handle cookies?

1. we can get all cookies of webpage using get


OUTPUT:len and all available cookies

2. we can add cookies

Here it does not show added cookies as ss didn’t cover entire screen but it shows increse in count

We can delete cookies but ensure that cookies are not added repetedly if cookies are are there it wont perfectly so use delete all
cookies method so function works properly

Css selector-

This are custemized selectors

Script:

You might also like