First, the automation test code at the beginning is linear, followed by the development of modular code, so involves the functions and methods of reference.
1. The most important differences between functions and methods:
When defining a function in a Python method, the function must write self. When you define a function individually, you do not need to write self. In Java, Self is invisible and does not need to be written out, but it must be written in Python.
#login method defines a function fun ()
1 class login (): 2 def Fun (self,a,b): 3 c=a+b 4
return c 5 6 d=login () 7 f=d.fun (4,5 8 print (f) 9
1 # Define a function fun () individually 2 class login (): 3 def Fun (A, b): 4 c=a+b5 print(c)
2. Logging out of the module
If the log-in exit above does not add driver=self.driver, the reference is to its own driver (that is, the driver). Then each of the following sentences will need to add self to the driver reference. To be able to find the object Oh.
Modular login.py Files:
Total Files:
The automatic test model of "python-"--parameterization