Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test Automation For Web-Based Applications

Similar presentations


Presentation on theme: "Test Automation For Web-Based Applications"— Presentation transcript:

1 Test Automation For Web-Based Applications
Portnov Computer School WebDriver Training Test Automation For Web-Based Applications Presenter: Ellie Skobel

2 Python Basics Continued
Day 2 Python Basics Continued

3 Flow Controls IF IF / ELIF / ELSE IF / ELSE Conditional assignment
x = 4 if x > 0: print("yes") IF / ELSE else: print("no") IF / ELIF / ELSE x = 4 if x > 2: print("yes") elif x > 0: print("still yes") else: print("no") Conditional assignment age = 12 name = "Bob" if age > 18 else "Bobby"

4 For Loops Iterate through a list: Iterate x times:
list_of_items = [1,2,3,4] for item in list_of_items: print('-> ' + item) Iterate x times: x = 4 for j in range(x): print('number:', x) Iterate and enumerate (count): items = ["apple", "orange"] for j, item in enumerate(items): print("item {0} is an {1}".format(j+1, item)) -> 1 -> 2 -> 3 -> 4 number: 0 number: 1 number: 2 number: 3 item 1 is an apple item 2 is an orange

5 print statement skipped for even numbers
Loop Flow Controls break: breaks out of the smallest enclosing loop for x in range(2, 6): if 8 % x == 0: print 8, 'equals', x, '*', 8/x break continue: skips code which follows and continues with the next iteration of the loop: x = 4 for j in range(x): if j % 2 == 0: continue print j, 'is an odd number' loop stops after x=2 8 equals 2 * 4 3 is an odd number print statement skipped for even numbers

6 PASS statement does nothing.
Loop ELSE Clause ELSE: a loop’s else clause runs when no break occurs for x in ('a', 'b', 'c', 'd'): pass else: print('loop finished') PASS statement does nothing. loop finished

7 Built-In Functions Built-in Functions Definition dict(iterable)
Create a new dictionary enumerate(sequence, start=0) Count and iterate through the sequence eval(expression) Compiles and immediately evaluates an expression exec(expression) This statement supports dynamic execution of Python code. float(arg), int(arg), str(arg) Return a float, integer, or string constructed from the argument hasattr(object, str_arg_name) Returns true/false whether an attribute exists in an object list(iterable) Create a new list View all of the Built-in functions here:

8 Built-In Functions: part 2
Definition open(name, mode=r) Open a file print(objects, sep=' ') Print objects to the stream file range(start, stop[, step]) Create lists containing arithmetic progressions reversed(seq) Return a reverse iterator. seq round(number[, ndigits]) Return the floating point value number rounded to ndigits digits sorted(iterable) Return a new sorted list from the items in iterable. zip([iterable, iterable,…]) This function returns a list of tuples (2 or more dimensional list) View all of the Built-in functions here:


Download ppt "Test Automation For Web-Based Applications"

Similar presentations


Ads by Google