<file_sep>import pytest


@pytest.mark.usefixtures("setUpBeforeAll")
class TestSampleOne:

    # @pytest.fixture(scope="class")
    # def setUpBeforeAll(self):
    #     print("I will be in same file and execute before all test cases")
    #     yield
    #     print("I will be in same file and execute after all test cases")

    @pytest.fixture()
    def setUp(self):
        print("Intializing x = 10 and y = 20")
        yield
        print("Operation successfully!!")

    def test_add(self, setUp):
        print("Test add functionslity")

    def test_sub(self, setUp):
        print("Test sub functionslity")

    def test_mul(self, setUp):
        print("Test mul functionslity")

    def test_div(self, setUp):
        print("Test div functionslity")
<file_sep># Dictionary 

phonebook = {}

print(phonebook)

phonebook = {
	'Andy': '9957558',
	'John': '64746484',
	'Jenny': '22282'
}

print(phonebook['Andy'])
print(phonebook['John'])
print(phonebook['Jenny'])


print(dir(phonebook))


for phone in phonebook.values():
	print(phone)

for phone in phonebook.keys():
	print(phone)

for key, value in phonebook.items():
	print(key , value)

print(phonebook)

phonebook['Mike'] = '9957558'

print(phonebook)

phonebook['Mike'] = '78474449'

print(phonebook)


print(phonebook.get('Andy'))


phonebook.update(Andy='353536735', Terry = '64547437')

print(phonebook)

update_dict = {
	'Juan': 4353536,
	'Kerry': 884747
	}

phonebook.update(update_dict)

print(phonebook)

del phonebook['Juan']

print(phonebook)




<file_sep>import time

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select


def verify_drag_and_drop():
    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://jqueryui.com/draggable/")
    driver.maximize_window()
    time.sleep(4)

    driver.switch_to.frame(0)

    draggable = driver.find_element_by_id("draggable")
    print(draggable)

    actions = ActionChains(driver)
    actions.click_and_hold(draggable).drag_and_drop_by_offset(draggable, 100, 100).perform()

    time.sleep(5)

    driver.close()
    driver.quit()


verify_drag_and_drop()
<file_sep>#### ASSIGNMENT II ###

>NOTE: Please make sure to write the code and share on my private slack chat


###### _Problem Statements_
- Define a function that helps to calculate the area of circle with different radius
  `23.45, 56.78, 45.67, 78.9`
  _Please consider the unit of these values as `cm`_

- Define a function using Python that helps to find the first and last character of any string

- Design a function that accept 4 values & find the average of those values.
  >_`Make sure to define seperate function to get the sum of all numbers`_

- Define a function that helps to find the square of any number and then add the same number to the squared number and return the final output.


<__HAPPY__> CODING__ GUYS....<file_sep>x = 10

y = 20


print(x + y)  #30

name = 'John'
age = 26

print('Hi ' + name + ' your age is ' + str(age))<file_sep>import pytest


@pytest.fixture(scope="module")
def setUpBeforeAllTC():
    print("I will be executing before all test cases")
    yield
    print("I will be executing after all test cases")


@pytest.fixture(scope="class")
def setUpBeforeAll():
    print("I will be in same file and execute before all test cases")
    yield
    print("I will be in same file and execute after all test cases")
<file_sep>#  Lets go and define string --- text data 
name = '<KEY>'

name = "<KEY>"



session = "It's our second week session"

session = 'It"s our second week session'

print(type(name))  # str


grade = 'A'

print(type(grade))


# String - is a set of characters which are align in a sequential manner

#indexing in programming language - always 0 --- 0 1 2 3

# 
print(name[0])

print(name[-1])

multiline_string = '''This is my multiple 
line of 
string'''
multiline_string = """This is my multiple 
line of 
string"""


print(multiline_string)


<file_sep>import time

from selenium import webdriver
from selenium.webdriver.support.select import Select


def verify_static_dropdown():

    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.facebook.com/")
    driver.maximize_window()
    time.sleep(4)

    day_loc = driver.find_element_by_id("day")

    select_day = Select(day_loc)
    select_day.select_by_value("4")  # 4a

    time.sleep(3)

    month_loc = driver.find_element_by_xpath("//select[@title='Month']")
    select_day = Select(month_loc)
    select_day.select_by_visible_text("Mar")  # Mar

    time.sleep(3)

    year_loc = driver.find_element_by_name("birthday_year")
    select_day = Select(year_loc)
    select_day.select_by_index(3) # 2018

    time.sleep(3)

# This is for deselect functions

    select_day = Select(day_loc)
    select_day.deselect_by_value("4")  # 4

    time.sleep(3)

    month_loc = driver.find_element_by_xpath("//select[@title='Month']")
    select_day = Select(month_loc)
    select_day.deselect_by_visible_text("Mar")  # Mar

    time.sleep(3)

    year_loc = driver.find_element_by_name("birthday_year")
    select_day = Select(year_loc)
    select_day.deselect_by_index(3)  # 2018



    driver.close()
    driver.quit()

verify_static_dropdown()
<file_sep># Define a function that helps to calculate the area of circle with different radius
#   `23.45, 56.78, 45.67, 78.9`



def calculate_area_of_circle(radius):
	PI = 3.14
	result = PI * radius * radius
	return result


output = calculate_area_of_circle(23.45)
print(output)
output = calculate_area_of_circle(56.78)
print(output)
output = calculate_area_of_circle(45.67)
print(output)
output = calculate_area_of_circle(78.9)
print(output)


def find_last_and_first_char(text):
	first_char = text[0]
	last_char = text[-1]
	print(first_char + ' - ' + last_char)
	return first_char,last_char

find_last_and_first_char("This is python class")
find_last_and_first_char("Its awesome to be here")


#Define a function that helps to find the square of any number and then add the same number to the squared number and return the final output.

def calculate_square_and_add(number):
	square = number * number
	result = square + number
	return result


output = calculate_square_and_add(6)
print(output)
output = calculate_square_and_add(10)
print(output)




<file_sep>## To define string

random_string = 'This is a session on python'

another_string = "Its awesome to be here with you all"

new_string_one = "It's awesome to be here with you all"

new_string = 'It\'s awesome to be here with you all'

new_string_two = "It\"s awesome to be here with you all"

# print(new_string)

# print(new_string_two)

new_string_two = "HELLO Guys !!"

# To find the length of string
len(new_string_two)



print(len(new_string_two))

# # To access O
print(new_string_two[4])

# Slicing of string
print(new_string_two[0:4])   # including 0 excluding 4

print(new_string_two[2:13])

print(new_string_two[2:len(new_string_two)])

print(new_string_two[2:])

print(new_string_two[:5])


print(new_string_two[-4:-1])

# print(new_string_two[-1:-4])

# Changes the cases -

new_string_two = "HELLO Guys !!"

new_string_title = "hELLO guys !!"

print(new_string_two.lower())
print(new_string_two.upper())
print(new_string_title.title())  ## it will convert the first letter of every word within any string in upper case
print(new_string_title.capitalize())  # it will convert the first letter of any string in upper case


# 

hi_string = new_string_title.replace('Hi', 'Hello')
print(hi_string)

#
L_count = new_string_title.count('L') 
print(L_count)
l_count = new_string_title.count('l')
print(l_count)


# 
name_list = "Mr. <NAME>"

split_string = name_list.split()
print(split_string)

split_string = name_list.split('.')
print(split_string)


# 
space_string = '<NAME>'
print(len(space_string)) # 8

space_string_two = ' <NAME> '
print(len(space_string_two)) # 10

space_string_strip = space_string_two.strip()
print(len(space_string_strip))


#
#print(dir(space_string_strip))

# 

print(space_string.find('Doe')) # 0 - 14

print(space_string.find('z'))


# 
print(space_string.index('J'))
print(space_string.index('Doe'))

print(space_string[:-1])

print(space_string)





<file_sep>import py_compile

py_compile.compile("./first_script_compile.py")<file_sep>import time
import pytest

from selenium import webdriver


class TestAmazonProduct:

    @pytest.fixture
    def setUp(self):
        self.driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
        self.driver.get("https://www.amazon.in")
        self.driver.maximize_window()
        time.sleep(4)
        yield
        time.sleep(3)
        self.driver.close()
        self.driver.quit()

    def test_product_title(self, setUp):
        self.driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "homepage.png")
        search_box = self.driver.find_element_by_id("twotabsearchtextbox")
        search_box.send_keys("Macbook pro")
        search_icon = self.driver.find_element_by_xpath("//input[@type='submit']")
        search_icon.click()
        time.sleep(5)
        self.driver.save_screenshot(
            "/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "productlisting.png")
        parent_window = self.driver.current_window_handle
        print(parent_window)
        self.driver.find_element_by_xpath("(//a[@class='a-link-normal a-text-normal'])[1]").click()
        time.sleep(3)
        windows_set = self.driver.window_handles
        print(windows_set)

        for window in windows_set:
            if (window != parent_window):
                self.driver.switch_to.window(window)
                self.driver.save_screenshot(
                    "/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots/" + "childtab.png")
        productTitle = self.driver.find_element_by_id("productTitle")
        print(productTitle.text)
        assert productTitle.text == "Macbook pro"

    def test_product_price(self, setUp):
        self.driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "homepage.png")
        search_box = self.driver.find_element_by_id("twotabsearchtextbox")
        search_box.send_keys("Macbook pro")
        search_icon = self.driver.find_element_by_xpath("//input[@type='submit']")
        search_icon.click()
        time.sleep(5)
        self.driver.save_screenshot(
            "/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "productlisting.png")
        parent_window = self.driver.current_window_handle
        print(parent_window)
        self.driver.find_element_by_xpath("(//a[@class='a-link-normal a-text-normal'])[1]").click()
        time.sleep(3)
        windows_set = self.driver.window_handles
        print(windows_set)

        for window in windows_set:
            if (window != parent_window):
                self.driver.switch_to.window(window)
                self.driver.save_screenshot(
                    "/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots/" + "childtab.png")

        productPrice = self.driver.find_element_by_id("priceblock_ourprice")
        assert productPrice.text == "₹ 1,27,990.00"
<file_sep>from pysebootcamp.py_se_day07 import student_module
from pysebootcamp.py_se_day07.student_module import Student

# john = student_module.Student("John", 26, "B.E", 13244, "<EMAIL>", 1, "Python")
# mike = student_module.Student("Mike", 27, "B.E", 34353, 2, "Java")
# jenny = student_module.Student("Jenny", 23, "B.E", 758597, 3, "JavaScript", email="<EMAIL>")
# ramu = student_module.Student("Ramu", 26, "Ph.D", 343536, "<EMAIL>", 4, "Python")

john = Student("John", 26, "B.E", 13244, "<EMAIL>", 1, "Python")
mike = Student("Mike", 27, "B.E", 34353, 2, "Java")
jenny = Student("Jenny", 23, "B.E", 758597, 3, "JavaScript", email="<EMAIL>")
ramu = Student("Ramu", 26, "Ph.D", 343536, "<EMAIL>", 4, "Python")

print(john.name)
print(mike.name)
print(mike.name)<file_sep># # John

# print('Take the ingredients')
# print('Mix the ingredients')
# print('Pour on pan')
# print('bake one side properly')
# print('flip dosa')
# print('Bake other side')
# print('Serve dosa to John')

# print("================")

#  # Mary
# print('Take the ingredients')
# print('Mix the ingredients')
# print('Pour on pan')
# print('bake one side properly')
# print('flip dosa')
# print('Bake other side')
# print('Serve dosa to Mary')


# print("================")
#  # Tom
# print('Take the ingredients')
# print('Mix the ingredients')
# print('Pour on pan')
# print('bake one side properly')
# print('flip dosa')
# print('Bake other side')
# print('Serve dosa to Tom')

# print("================")


# DRY - Do not Repeat Yourself 

def make_dosas(name):   # parameter variable
	print('Take the flour')
	dosa_process()  # chef
	print('Serve dosa to ' + name)


def make_masala_dosas(name):   # parameter variable
	print('Take the masala')
	dosa_process()
	print('Serve dosa to ' + name)

def make_onion_dosas(name):   # parameter variable
	print('Take the onion')
	dosa_process()
	print('Serve dosa to ' + name)

def dosa_process():  # chef
	print('Mix the ingredients')
	print('Pour on pan')
	print('bake one side properly')
	print('flip dosa')
	print('Bake other side')


make_dosas('John')

print("================")

make_dosas('Mary')

print("================")

make_dosas('Tom')


















<file_sep>

dummy_string = 'This is my dummy string and seems it is gonna useful'

# when I get- i/e/n I want to print

for i in range(0, len(dummy_string)):

	if dummy_string[i] == 'i' or dummy_string[i] == 'e' or dummy_string[i] == 'n':
		print(dummy_string[i])



def print_i_e_n(text):
	dummy_string = text
	for i in range(0, len(dummy_string)):
		if dummy_string[i] == 'i' or dummy_string[i] == 'e' or dummy_string[i] == 'n':
			print(dummy_string[i])


print_i_e_n("Thsis is my test string")<file_sep>from selenium import webdriver
import time


def verify_search_functionality(search_text):
    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.flipkart.com")
    driver.maximize_window()
    time.sleep(4)

    ## ACTION
    driver.find_element_by_xpath("//button[@class='_2AkmmA _29YdH8']").click();

    search_box = driver.find_element_by_name("q")  # Find the location of search box
    # search_box.send_keys("Macbook pro")   # to enter text we have to use send_keys()
    search_box.send_keys(search_text)

    # Finding xpath using contains(attribute, textwithinattributevalue)
    search_icon = driver.find_element_by_xpath("//button[@type='submit']")
    search_icon.click()

    time.sleep(5)

    product_list = driver.find_element_by_xpath("//div[@class='_1HmYoV _35HD7C'][2]//div[@class='_3wU53n']")
    print(product_list.text)

    products_list = driver.find_elements_by_xpath("//div[@class='_1HmYoV _35HD7C'][2]//div[@class='_3wU53n']")
    print(len(products_list))
    for product in products_list:
        print(product.text)


    expected_product_lists = [
        'Apple MacBook Pro Core i5 8th Gen - (8 GB/256 GB SSD/Mac OS Mojave) MV962HN', 'Apple MacBook Pro Core i5 8th Gen - (8 GB/512 GB SSD/Mac OS Mojave) MV972HN',
        'Apple MacBook Pro Core i5 8th Gen - (8 GB/128 GB SSD/Mac OS Mojave) MUHN2HN/A'
    ]

    for i in range(0, len(expected_product_lists)):
        if(products_list[i].text == expected_product_lists[i]):
            print("The prouct name is valid")
        else:
            print("The product name is invalid")



verify_search_functionality("Macbook pro")<file_sep>
 <div style="text-align:center;">

 <img src="./pythonclipart.png" style="width:50%; text-align: center">

  <!-- <span style="font-family:Papyrus; font-size:2em; text-align: center;">Assignment III</span> -->

# ASSIGNMENT III

>NOTE: Please make sure to write the code and share on my private slack chat


#### _Problem Statements_
:pushpin:Define a function that helps to calculate the area of circle with different radius and print the area only when the area is divisible by 4

`23.48, 56.78, 45.67, 78.28`
_Please consider the unit of these values as `cm`_

:pushpin:Define a function using Python that helps to find the first five character of string in all the possible ways

:pushpin:Define a function using Python that helps to find the last 3 character of string in all the possible ways
  
:pushpin:Design a function that accept 6 values & find the average of those values which are only divisible by 6.
  >_`Do not create seperate function for addition`_

:pushpin:Define a function that helps to find the square of any number and then add the same number to the squared number only when the number is odd and return the final output.

:pushpin:Define a function that helps to print all the numbers between 5 and 50 with interval of 5 for ex. 5, 10, 15 and so on... 
  >_`Solve using both types of loop. Make sure to design different function for each loop`_

<span style="font-family:Papyrus; font-size:2em;">Happy Coding!</span>
 
 </div><file_sep># conditional statement is used to make your program smat to take decision based on certain condition


# Arithemitic
# 1 +  2 = 3


#relation operators   always return true or false
# > 
# >=
# <
# <=
# ==



def find_even_odd(number):
	is_even = number % 2 == 0  # true / false
	print(is_even)

	if is_even == True:
		print('The number is ' + str(number) + ' is even')
		
	else:
		print('The number is ' + str(number) + ' is odd')



find_even_odd(40) #
find_even_odd(39)
find_even_odd(40) #
find_even_odd(39)
find_even_odd(40) #
find_even_odd(39)

# def find_odd(number):
# 	is_odd = number % 2 != 0
# 	print('The number is ' + str(number) + ' is odd')

# find_odd(23)
# find_odd(40)

# One way conditional 
# condition -- valid / true then only the program / function is gonna take decision / gonna execute

# if condition:



# Two way conditional 
#condition -- valid/invalid / true/false then only the program / function is gonna take decision / gonna execute

# Multiway conditional way 
<file_sep>import time

from selenium import webdriver
import pytest


class AmazonWebsiteTest:

    @pytest.fixture
    def setUp(self):
        self.driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
        self.driver.get("https://www.amazon.in")
        self.driver.maximize_window()
        time.sleep(4)
        yield
        time.sleep(3)
        self.driver.close()
        self.driver.quit()

    def test_website_title(self, setUp):
        # driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
        # driver.get("https://www.amazon.in")
        # driver.maximize_window()
        # time.sleep(4)
        self.driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "homepage.png")
        pageTitle = self.driver.title
        assert pageTitle == "Online Shopping site in India: Shop Online for Mobiles, Books, Watches, Shoes and More - Amazon.in"

    def test_search_functionality(self, setUp):
        # driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
        # driver.get("https://www.amazon.in")
        # driver.maximize_window()
        # time.sleep(4)
        self.driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "homepage.png")
        search_box = self.driver.find_element_by_id("twotabsearchtextbox")
        search_box.send_keys("Macbook pro")
        search_icon = self.driver.find_element_by_xpath("//input[@type='submit']")
        search_icon.click()
        time.sleep(5)
        self.driver.save_screenshot(
            "/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "productlisting.png")
        searched_product = self.driver.find_element_by_xpath("(//a[@class='a-link-normal a-text-normal'])[1]")
        assert searched_product.is_displayed() == True
<file_sep># 
def add_numbers():
	no_one = 20
	no_two = 30
	result = no_one + no_two
	print(result)

# add_numbers()

def add_numbers_version_01(x, y):
	no_one = x
	no_two = y
	result = no_one + no_two
	#print("The value of result variable is " +  str(result) ) ### ?
	return result
	
	# print(result)

# x = add_numbers_version_01(20,30)
# print(x)  # ?

	# not returning anything to you 

# add_numbers_version_01(50, 10)
# add_numbers_version_01(300, 29)
# add_numbers_version_01(20.78, 56.89)


# # Average of two numbers 
# Add 2 nos and then divide the sum with nos. of value 

# no_one = 50 
# no_two = 60 
# nos_sum = no_one + no_two

# nos_sum = add_numbers_version_01(50, 50)   ### This particular line of code will throw error

# avg  = nos_sum/2  # 50.0

# print(avg)  ## 

# nos_sum = add_numbers_version_01(40, 50)   ### This particular line of code will throw error

# avg  = nos_sum/2  # 50.0

# print(avg)  ## 


# nos_sum = add_numbers_version_01(140, 150)   ### This particular line of code will throw error

# avg  = nos_sum/2  # 50.0

# print(avg)  ## 



def calculate_avg_of_two_numbers():
	nos_sum = add_numbers_version_01(50, 50) 
	avg  = nos_sum/2  # 50.0
	return avg

output = calculate_avg_of_two_numbers()
print(output)


def calculate_avg_of_two_numbers_version_02(x, y):
	nos_sum = add_numbers_version_01(50, 50)
	avg  = nos_sum/2  # 50.0
	return avg



def calculate_avg_of_two_numbers_version_01(x, y):
	nos_sum = add_numbers_version_01(x, y) 
	avg  = nos_sum/2  # 50.0
	return avg


output = calculate_avg_of_two_numbers_version_01(30, 30)
print(output)

output = calculate_avg_of_two_numbers_version_01(40, 50)
print(output)

output = calculate_avg_of_two_numbers_version_01(140, 150)
print(output)

output = calculate_avg_of_two_numbers_version_01(230, 30)
print(output)



<file_sep># Define a function that helps to calculate the area of circle with different radius and print the area only when the area is divisible by 4

# 23.48, 56.78, 45.67, 78.28 Please consider the unit of these values as cm



def calculate_area(radius):
	PI = 3.14
	area = PI * radius * radius
	if area % 6 != 0:
		print('The area of circle with radius {0} is {1}'.format(radius, area))


def calculate_square(num):
	squared = num * num
	if num % 2 != 0:
		new_num = squared + num
		print(new_num)
	print(squared)


# Define a function using Python that helps to find the first five character of string in all the possible ways

string = HAPPY CODING

string[9:len(string)]

string[9:]

string[-3:]

# Define a function using Python that helps to find the last 3 character of string in all the possible ways


for i in range(5, 51):
	print(1)


i = 5
while i <= 50:
	print(i)
	i = i + 5

#Design a function that accept 6 values & find the average of those values which are only divisible by 6.

def calculate_average(n1, n2, n3, n4):
	sum = 0
	count = 0

	if n1 % 6 == 0:
		sum = sum + n1  # n1=6
		count = count + 1

	if n2 % 6 == 0:
		sum = sum + n2  # n1 = 12
		count = count + 1

	if n3 % 6 == 0:
		sum = sum + n3  # n3 = 4
		count = count + 1

	if n4 % 6 == 0:
		sum = sum + n4 # n4= 18
		count = count + 1

    avg = sum / count

    print(avg)
	





<file_sep>import pytest


def test_add():
    x = 45;
    y = 50;
    r = x + y
    assert r == 96


def test_product():
    x = 50;
    y = 50;
    r = x * y
    assert r == 2500


def subtract():
    x = 45;
    y = 50;
    r = x - y
    assert r == -5


# o = add()
# if (o == 95):
#     print("Its pass")
# else:
#     print("its fail")
#
# o = product()
# if (o == 1500):
#     print("Its pass")
# else:
#     print("its fail")
#
# o = subtract()
# if (o == 5):
#     print("Its pass")
# else:
#     print("its fail")

<file_sep>firstname = 'John'
lastname = 'Doe'

age = 26



print('Hey ' +  firstname + ', your last name is' + lastname)



<file_sep>import pytest


def test_add():
    x = 45
    y = 50
    r = x + y
    print(r)
    assert r == 95


def testProduct():
    x = 50
    y = 50
    r = x * y
    print(r)
    assert r == 2500


def testSubtract():
    x = 45
    y = 50
    r = x - y
    print(r)
    assert r == 5
<file_sep>import time

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select


def verify_dynamic_dropdown():

    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.flipkart.com/")
    driver.maximize_window()
    time.sleep(4)

    driver.find_element_by_xpath("//button[@class='_2AkmmA _29YdH8']").click()

    actions = ActionChains(driver)

    electronics = driver.find_element_by_xpath("//span[text()='Electronics']")

    actions.move_to_element(electronics).perform()


    samsung = driver.find_element_by_xpath("(//a[@title='Samsung'])[1]")

    #actions.move_to_element(samsung).click().perform()  # action chaining

    # actions.move_to_element(samsung).perform()
    # actions.click().perform()  # action chaining

    actions.move_to_element(samsung).click().perform();

    time.sleep(7)


verify_dynamic_dropdown()<file_sep># Integer (int)  
# Decimal (float)
# Text (str)
# Boolean (bool)

# Complex (2 + 3i)


# define Integer
age = 26


print(type(age))

age = 35.89

print(type(age))

# define decimal 
rate = 23.50

res = type(rate)
print(res)


# Text
name = "<NAME>"
name = '<NAME>'

print(type(name))



# Boolean 
isCorrect = True
isFalse = False


print(type(isFalse))<file_sep># Define a function which calculate the age of any individual from current date


# born_year = 1990
# current_year = 2020
# age = current_year - born_year
# print(age)


# born_year = 1992
# current_year = 2020
# age = current_year - born_year
# print(age)


# born_year = 1998
# current_year = 2020
# age = current_year - born_year
# print(age)


# born_year = 2000
# current_year = 2020
# age = current_year - born_year
# print(age)




def calculate_age(b_year):
	born_year = b_year
	current_year = 2020
	age = current_year - born_year
	print(age)


def calculate_age(b_year):
	born_year = b_year
	current_year = 2020
	age = current_year - born_year
	print(age)


calculate_age(1992)  # 28
calculate_age(1990)  # 30
calculate_age(1998)  # 22
calculate_age(2000)  # 20


# DRY -- Do not repeat 


# Define a function which gonna convert Temperature from celcius to fahrenheit and vice versa

def convert_cel_to_far(celcius_temp):
	far_temp = (celcius_temp * 9/5) + 32
	print("The fahrenheit conversion of " + str(celcius_temp) + " is " + str(far_temp))

def convert_far_to_cel(far_temp):
	celcius_temp = (far_temp - 32) * 5/9
	print("The celcius conversion of " + str(far_temp) + " is " + str(celcius_temp))

convert_cel_to_far(100)
convert_cel_to_far(150)

convert_far_to_cel(250)
convert_far_to_cel(200)


# Define a function where you have to find whether the given number is odd or even


def find_even(number):
	is_even = number % 2 == 0
	print(is_even)
	print('The number is ' + str(number) + ' is even')

find_even(40)
find_even(39)

def find_odd(number):
	is_odd = number % 2 != 0
	print('The number is ' + str(number) + ' is odd')

find_odd(23)
find_odd(40)



<file_sep>class ArithmeticClass:

    def __init__(self, number_one, number_two):
        self.number_one = number_one
        self.number_two = number_two

    def add(self):
        result = self.number_one + self.number_two
        return result

    def mul(self):
        result = self.number_one * self.number_two
        return result

    def sub(self):
        result = self.number_one - self.number_two
        return result

    def div(self):
        result = self.number_one / self.number_two
        return result
<file_sep>import time

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys


def verify_drag_and_drop():
    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.google.com")
    driver.maximize_window()
    time.sleep(4)

    search_box = driver.find_element_by_name("q")

    #search_box.send_keys("Python")

    search_box.send_keys(Keys.ENTER)

    time.sleep(3)

    actions = ActionChains(driver)

    #actions.move_to_element(search_box).send_keys(Keys.SHIFT).send_keys("python").send_keys("\ue007").perform()

    actions.key_down("\ue008", search_box).send_keys("python").key_up("\ue008", search_box).send_keys("\ue007").perform()


    #actions.send_keys(Keys.ENTER).perform()



    #driver.find_element_by_name("btnK").click()

    time.sleep(3)


verify_drag_and_drop()


<file_sep>#Parameter  Return

#0    0

def add_numbers1():
	no_one = 20
	no_two = 30
	result = no_one + no_two

#0    1

def add_numbers2():
	no_one = 20
	no_two = 30
	result = no_one + no_two
	return result

#1     0

def add_numbers3(x, y):
	no_one = x
	no_two = y
	result = no_one + no_two

#1     1

def add_numbers4(x, y):
	no_one = x
	no_two = y
	result = no_one + no_two
	#return result
	return result
	

output = add_numbers4(40, 50)
print(output)

<file_sep># class Courses():
# 	name
# 	duration
# 	faculty
# 	fees

# completionRate()
# studentEnrolledForCourse()

class Courses:
	def __init__(self, name, duration, faculty, fees):
		self.name = name
		self.duration = duration
		self.faculty = faculty
		self.fees = fees

	def completionRate(self, complete_percent):
		print('The course is completed {} %'.format(complete_percent))

	def studentEnrolledForCourse(self, list_of_students):
		for student in list_of_students:
			print(student)
		
python_course = Courses('Python', 3, 'Jenny', 15000)

print(python_course)

print(python_course.name)
python_course.completionRate(30)

java_course = Courses('Java', 5, 'Sam', 15000)

print(java_course.name)
java_course.completionRate(50)



# class Students()
# 	name
# 	age
# 	education
# 	contact
# 	email
# 	ID

# courseEnrolledFor()
# feesPaid()
# study()
# givenExam()


# class Faculty():
# 	name
# 	expertise
# 	education
# 	contact
# 	email

# teachCourse()
# paid()
# completedCourse()

<file_sep>from selenium import webdriver
import time
from time import sleep




def open_chrome_browser():

    driver = webdriver.Chrome(executable_path="/Users/gaurnitai/Desktop/Programming/Python/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.amazon.in")

    # Here we are using ID locator to find element
    searchBox = driver.find_element_by_id("twotabsearchtextbox")
    searchBox.send_keys("Macbook Pro")  # here we are entering text to serach box

    # To find the location of search icon webelement
    searchIcon = driver.find_element_by_class_name("nav-input") # here we use class name to find element
    searchIcon.click()

    sleep(3)



    # To find element element using link_text
    # macbook_pro_details = driver.find_element_by_link_text("Apple 15\" MacBook Pro, Retina, Touch Bar, 2.9GHz Intel Core i7 Quad Core, 16GB RAM, 512GB SSD, Silver, MPTV2LL/A (Newest Version)")
    # macbook_pro_details.click()

    # To find all the links on webpage
    link = driver.find_element_by_tag_name("a")  # It always going to return the very first link
    print(link)
    print(link.text)

    list_of_links = driver.find_elements_by_tag_name("a") # Its going to return the list of links
    #print(list_of_links)
    for link in list_of_links:
        print(link.text)


    # To find element element using partial_link_text
    macbook_pro_details = driver.find_element_by_partial_link_text("Apple MacBook Pro")
    macbook_pro_details.click()

    sleep(5)



    driver.close()

def open_ff_browser():

    driver = webdriver.Firefox(executable_path="/Users/gaurnitai/Desktop/Programming/Python/PySeBootcamp/drivers/geckodriver")
    driver.get("https://www.amazon.in")

    driver.close()


open_chrome_browser()<file_sep># One way if

# Two way - if else



# Multiway 

# 

# I have to find whether number is divisible by 6 only when the number is positive 

num = 6 

if num > 0:
	if num % 6 == 0:
		print(num)
	else:
		print('The number is not divisible by 6')
else:
	if num == 0:
		print('The number zero')
	else:
		print('Tyhe number is negative')


# 
dummy_string = 'This is my dummy string and seems it is gonna useful'

dummy_string[0]


splitted_words = dummy_string.split()



#['This', 'is', 'my', 'dummy', 'string', 'and', 'seems', 'it', 'is', 'gonna', 'useful']

print(splitted_words)

for i in range(0, len(splitted_words)):
	if splitted_words[i] == 'my' or splitted_words[i] == 'dummy' or splitted_words[i] == 'seems':
		print(splitted_words[i])










<file_sep>class Courses:
	def __init__(self, name, duration, faculty, fees):
		self.name = name
		self.duration = duration
		self.faculty = faculty
		self.fees = fees

	def completionRate(self, complete_percent):
		print('The course is completed {} %'.format(complete_percent))

	def studentEnrolledForCourse(self, list_of_students):
		for student in list_of_students:
			print(student)

python_course = Courses('Python', 3, 'Jenny', 15000)

print(dir(python_course))

print(python_course.name)<file_sep>
<img src="./pythonclipart.png" style="width:50%; text-align: center">

### PY-SE-BOOTCAMP 

### _A Professional Yoga with Selenium & Python_  

_This repo contains the code we discussed throughout the course. Also, it will have assignments solution._

###### ❝ WHAT DO WE DO WITH CODE HERE :ok_woman: :question: ❞
- _Open the respective file_ 
- _Copy the content of file_
- _Create new file with meaningful name on your local machine and paste the copied code_ 🏗
- _Save the file and execute_
- _That pretty simple 😀_

###### ❝ A BIG THANKS TO ALL FOR YOUR DONATION ❞

__*<NAME>*__

__*<NAME>*__

__*<NAME>*__

__*<NAME>*__

__*Snehal*__

__*<NAME>*__

__*<NAME>*__

__*<NAME>*__


<file_sep>names = ('John', 'Jane', 'Jenny', 'Mike', 'Jane')

names = ()

# print(names[0])

# for name in names:
# 	print(name)

# print(dir(names))

# print(names.index('Jane'))

# immutable - 
# mutable - which can be changes 

# print(names.count('Jane'))

# print(names)

# Set 
set_names = {'John', 'Jane', 'Jenny', 'Mike', 'Jane'}

print(set_names)

print(dir(set_names))

set_names.add('Jackson')

print(set_names)

set_names.add('<NAME>')

print(set_names)

for name in set_names:
	print(name)



copy_set = set_names.copy()
print(copy_set)

copy_set.clear()
print(copy_set)

empty_set = set()
print(empty_set)

empty_set.add('Orange')
print(empty_set)


set_names = {'John', 'Jane', 'Jenny', 'Mike', 'Jane'} # superset

new_set = {'John', 'Jane', 'Andy'}  # subset


is_subset = new_set.issubset(set_names)
print(is_subset)

is_intersection = new_set.intersection(set_names)
print(is_intersection)

is_intersection = new_set.difference(set_names)
print(is_intersection)

is_intersection = set_names.difference(new_set)
print(is_intersection)



# set_names.remove('Jackson')
# print(set_names)

set_names.discard('Jackson')
print(set_names)











<file_sep>
# words = 'This' , 'is', 'python', 'Course'

# print(words)


words = ['This' , 'is', 'python', 'Course'] # sequential manner 

print(words)


# List - ['This' , 'is', 'python', 'Course']

empty_list = []

print(empty_list)

# add some more items
# i want to remove items from list
# i want to add some items to the end of the list
# i want to add items in between to the list items
# replace 
# clear all the items 
# copy one list into list 
# reverse 


# Add 
# print(dir(empty_list))


# i want to add some items to the end of the list
empty_list.append('Python')
print(empty_list)
empty_list.append('Java')
print(empty_list)
empty_list.append('JS')
print(empty_list)

empty_list.append('Ruby')
print(empty_list)
empty_list.append('C#')
print(empty_list)
empty_list.append('JS')
print(empty_list)

empty_list.insert(1, 'Ruby')
print(empty_list)

empty_list.remove('Ruby')
print(empty_list)


another_list = empty_list.copy()

print("Before clear " , another_list)

another_list.clear()

print("After clear ", another_list)


print("Before pop " , empty_list)

empty_list.pop()

print("After pop ", empty_list)


print(len(empty_list))

for i in range(0, len(empty_list)):
	if empty_list[i] == 'Python':
		print(empty_list[i])

# Enhanced For loop

for item in empty_list: 
	print(item)

# empty_list[1]

# empty_list[-1]

print("Before sort " , empty_list)

empty_list.sort(reverse=True)

print("After sort ", empty_list)

empty_list.reverse()


print("After reverse ", empty_list)

print(empty_list)
for item in empty_list: 
	print(item)



# Tuple  - ('This' , 'is', 'python', 'Course')

names = ('John', 'Jane', 'Jenny', 'Mike')



# Set - {'This' , 'is', 'python', 'Course'}


 

# Dictionary
<file_sep>from selenium import webdriver
import time

# A - Arrange (Setup/Prerequsite)
# A - Action
# A = Assert  (Validate)



def verify_search_functionality(search_text):

    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.snapdeal.com/offers/essential?")
    driver.maximize_window()
    time.sleep(4)

#//button[@class='_2AkmmA _29YdH8']

## ACTION
    search_box = driver.find_element_by_name("keyword")   # Find the location of search box
    #search_box.send_keys("Macbook pro")   # to enter text we have to use send_keys()
    search_box.send_keys(search_text)

# Finding xpath using contains(attribute, textwithinattributevalue)
    search_icon = driver.find_element_by_xpath("//button[contains(@class, 'searchformButton')]")
    search_icon.click()

    search_box = driver.find_element_by_name("keyword")   # Find the location of search box
    #search_box.send_keys("Macbook pro")   # to enter text we have to use send_keys()
    search_box.send_keys(search_text)

    search_icon = driver.find_element_by_xpath("//button[contains(@class, 'searchformButton')]")
    search_icon.click()
    time.sleep(5)

## ASSERT
    search_product_info_element = driver.find_element_by_xpath("(//span[@class='nnn'])[1]")
    search_product_info =  search_product_info_element.text

    if(search_product_info == "We've got 10000+ results for 'samsung mobile phone'"):
        print("We have successfully searched the product " + search_text)
    else:
        print("The search product is not listed here")





    driver.close()
    driver.quit()


# verify_search_functionality("Macbook pro back cover")

verify_search_functionality("samsung mobile phone")<file_sep>def make_dosas(name):
	print('Take the ingredients')
	print('Mix the ingredients')
	print('Pour on pan')
	print('bake one side properly')
	print('flip dosa')
	print('Bake other side')
	print('Serve dosa to ' + name)


def make_different_dosas(name, ingredients):  # parameters
	print('Take the ' + ingredients) 
	print('Mix the ingredients')
	print('Pour on pan')
	print('bake one side properly')
	print('flip dosa')
	print('Bake other side')
	print('Serve dosa to ' + name)


make_different_dosas('John', 'Cheese') # arguments
print("-------------")
make_different_dosas('Ramu', 'Masala')
print("-------------")
make_different_dosas('Kid', 'flour')



<file_sep>import time

from selenium import webdriver


def verify_drag_and_drop():
    # ARRANGE

    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.amazon.in")
    driver.maximize_window()
    time.sleep(4)

    driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "homepage.png")

    search_box = driver.find_element_by_id("twotabsearchtextbox")  # Find the location of search box
    search_box.send_keys("Macbook pro")  # to enter text we have to use send_keys()

    # Finding xpath using contains(attribute, textwithinattributevalue)
    search_icon = driver.find_element_by_xpath("//input[@type='submit']")
    search_icon.click()

    time.sleep(5)

    driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots" + "productlisting.png")

    parent_window = driver.current_window_handle
    print(parent_window)

    driver.find_element_by_xpath("(//a[@class='a-link-normal a-text-normal'])[1]").click()

    time.sleep(3)

    windows_set = driver.window_handles

    print(windows_set)

    for window in windows_set:
        if (window != parent_window):
            driver.switch_to.window(window)
            driver.save_screenshot("/Users/gaurnitai/Desktop/dummyrepo/py-se-bootcamp/screenshots/" + "childtab.png")

    productTitle = driver.find_element_by_id("productTitle")
    print(productTitle.text)

    driver.switch_to.window(parent_window)

    time.sleep(3)

    driver.find_element_by_xpath("(//a[@class='a-link-normal a-text-normal'])[1]").click()

    time.sleep(9)


verify_drag_and_drop()
<file_sep>
# To define n nos. of time execution fo certain code 


def find_even_odd(number):
	is_even = number % 2 == 0  # true / false
	print(is_even)

	if is_even == True:
		print('The number is ' + str(number) + ' is even')
		
	else:
		print('The number is ' + str(number) + ' is odd')



# find_even_odd(40) #
# find_even_odd(39)
# find_even_odd(40) #
# find_even_odd(39)
# find_even_odd(40) #
# find_even_odd(39)




# starting point & ending point

# for loop


for num in range(1, 6):  # num is loop control variable
	print(num)  

print("=======")

# while

num = 1

while num < 6:
	print(num)
	num = num + 1
	







<file_sep># global variable
# local variable 


ingredients = 'Cheese'


def make_different_dosas(name):  # parameters
	# ingredients = 'Cheese'
	print('Take the ' + ingredients) 
	print('Mix the ingredients')
	print('Pour on pan')
	print('bake one side properly')
	print('flip dosa')
	print('Bake other side')
	print('Serve dosa to ' + name)


def make_dosas(name):  # parameters
	print('Take the ' + ingredients) 
	print('Mix the ingredients')
	print('Pour on pan')
	print('bake one side properly')
	print('flip dosa')
	print('Bake other side')
	print('Serve dosa to ' + name)

make_different_dosas('John')

make_dosas('Kid')

<file_sep>from selenium import webdriver
from time import sleep


def test_documentation_link():
    driver = webdriver.Chrome("/Users/gaurnitai/Desktop/PySeBootcamp/drivers/chromedriver")
    driver.get("https://www.selenium.dev/")
    driver.maximize_window();
    sleep(4)

    # driver.find_element_by_link_text("Downloads").click()

    # Find Downloads using Absolute xpath
    # xpath = //html/body/header/nav/a[1]

    # Absolute xpath for Downloads
    # driver.find_element_by_xpath("//html/body/header/nav/a[1]").click()

    # Relative xpath for Downloads
    driver.find_element_by_xpath("(//a[@href='/downloads'])[1]").click()

    sleep(4)
    # documentation = driver.find_element_by_link_text("documentation")

    # Absolute xpath for Downloads
    # documentation = driver.find_element_by_xpath("//html/body/header/nav/a[3]")

    # Relative xpath for Downloads
    documentation = driver.find_element_by_xpath("(//a[@href='/documentation'])[1]")

    documentation.click()

    #//header[@id='header']//a[@href='/about']

    sleep(8)

    driver.close()
    driver.quit()
<file_sep>
class Student:
    def __init__(self, name, age, education, contact, ID, course_enrolled, email=None):
        self.name = name
        self.age = age
        self.education = education
        self.contact = contact
        self.email = email
        self.ID = ID
        self.course_enrolled = course_enrolled

    def courseEnrolledFor(self):
        # John has enrolled for course
        print(self.name + " has enrolled for " + self.course_enrolled)

    def feesPaid(self, paid_fees):
        print("{} has paid {} /-".format(self.name, paid_fees))
        print("{1} has paid {0} /-".format(paid_fees, self.name))
        print("{name} has paid {fees} /-".format(name=self.name, fees=paid_fees))

    def print_obj_properties(self):
        print(self.name, self.email, self.contact)


john = Student("John", 26, "B.E", 13244, "<EMAIL>", 1, "Python")
mike = Student("Mike", 27, "B.E", 34353, 2, "Java")
jenny = Student("Jenny", 23, "B.E", 758597, 3, "JavaScript", email="<EMAIL>")
ramu = Student("Ramu", 26, "Ph.D", 343536, "<EMAIL>", 4, "Python")

# print(john.name)
# john.courseEnrolledFor()
# john.feesPaid(15000)

# print(mike.name)
# mike.courseEnrolledFor()
# mike.feesPaid(15000)
# print(mike.email)
#
# john.print_obj_properties()
<file_sep># Define a function which calculate the age of any individual from current date

# Define a function which gonna convert Temperature from celcius to fahrenheit and vice versa

# Define a function where you have to find whether the given number is odd or even
<file_sep>from py_se_day14.arithmetic_module import ArithmeticClass
import pytest


class TestArithmeticClass:

    @pytest.mark.run(order=4)
    def test_add_functionality(self):
        aclass = ArithmeticClass(40, 50)
        r = aclass.add()
        assert r == 90

    @pytest.mark.run(order=1)
    def test_sub_functionality(self):
        aclass = ArithmeticClass(40, 50)
        r = aclass.sub()
        assert r == 90

    @pytest.mark.run(order=3)
    def test_mul_functionality(self):
        aclass = ArithmeticClass(40, 50)
        r = aclass.mul()
        assert r == 2000

    @pytest.mark.run(order=2)
    def test_div_functionality(self):
        aclass = ArithmeticClass(100, 50)
        r = aclass.div()
        assert r == 2
