Posts

https://selenium-webdriverqa.blogspot.com/2014/06/how-to-setup-selenium-web-driver-with.html

Python Programming - Log file is not capturing the data?

Image
If any one of you faced a problem during the selenium automation using python. Where you have coded a logger file utility with the below sample code logging.basicConfig(filename="./Logs/automation.log", format='%(asctime)s: %(levelname)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') and automation.log fine is not getting created for you in Log folder. Solution is, use force=True complete code is import logging class LogGen: @staticmethod def logGen(): logging.basicConfig(filename="./Logs/automation.log", format='%(asctime)s: %(levelname)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', force=True) logger = logging.getLogger() logger.setLevel(logging.INFO) return logger logfile will be created like this

How to setup Selenium Web driver with eclipse ..

Image
When I was new to selenium or you can say that selenium is new for me, I was too confused about this how can I automate a website using selenium even when i do,t know how to use selenium with eclipse, when I do,t know how to configure selenium with my Java project to run that project. Let us start with  how to set up selenium with our java project. The Basic requirement for this is the following. 1.Java JDK setup. 2.Eclipse setup(Any version). 3. Selenium Java Client Driver. 1.Java JDK setup: If you are new to java technology or eclipse so the first thing you need to do is, Download and install JDK in your system.You can simply download this from  http://www.oracle.com/technetwork/java/javase/downloads/index.html and make sure that you have set the path variable from My Computer > System Properties > Advance System Setting > Advance > Environment variable > Path 2.Eclipse Setup: You can download eclipse from...

Selenium Webdriver Day 1 : Class and object

To understand both topics first we have to learn about  OOPS(Object Oriented Programming)  Technique. In Object oriented programming we have to design a program using Objects and Classes. OOPS provide you the freedom from writing down the complete code within same class , it allow you to write down the code anywhere and access that code using objects. OOPS have some basic feature like (Abstraction, Encapsulation, Polymorphism and Inheritance ), we will discuss about this on later chapter. Class :  In java class is like a paperwork in which we define details of an object. Also we can say that this is a logical entity. Example : Human is a Class. Object :  An Object is a real time entity . We can also say that an object is a logical as well as physical entity. In java objects are created to use methods and variables defined inside the class.In java JVM(java virtual machine)  is responsible to create an object. Example : An individual human in this ea...

Selenium Webdriver Day 5 : Polymorphism

Basically,  Poly means many and morph means from, so polymorphism refers to a programming language's ability to process objects differently depending on their data types or class. Polymorphism is thus the ability of different classes of objects to respond to the same message in different, class specific ways. In this polymorphic methods have one name but different implementation for different classes. Example : Suppose their is a base class named Shape and this having some method to calculate getArea() , now multiple derived classes are extending base classes like (Circle, Rectangle etc).All the derived classes are having same  getArea() method to calculate area on the basis of their properties. To achieve this all the derived classes must override base class  getArea() method. Method overriding forms the basis for one of the java's most powerful concept : Dynamic method dispatch or lookup.  Dynamic method dispatch is a process by which a call to an overridden m...

Sending test report in mail

After executing our completed test suite now the new problem is how to send Test report to your or client email id. Some time  it takes 5-10 hours to complete a test execution. We are human being so we can not just sit in front of system and wait till all the test execution will be completed  so in this case we add a new class in our program which send email with attachment(Report file) to your email. Also some time this is client requirement to send all the report files to him. To send report in email, first you have to import activation and mail jar files to your program. You can download this from below links. Activation.jar mail.jar Now add new java class in your project :        import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.*; import javax.mail.internet.*; import java.util.*;         public class SendMail   ...

Selenium Webdriver Day 4 : Inheritance

Inheritance : This is another major properties of OOPS(Object Oriented Programming). In this one class inherit the property of other class.Basically it means derivation of one class from another class, so that the attributes and methods of one class are part of the definition of another class. In this the first class is referred as base class or parent class . The second class is referred as child class or sub-class . To inherit a class we need use a keyword " extends " in sub-class. Why we use inheritance in java : > For method overriding. > For using methods and variables of one class to another class. > For code re-usability Look at the java code below : public class Parent { public void parent_method1() { System.out.println("This is parent method1 "); } public void parent_method2() { System.out.println("This is parent method2 "); } public void parent_method3() { System.out.println("This is parent method3 ...

Selenium Webdriver Day 3 : Abstraction and Encapsulation

Abstraction: In OOPS abstraction means hiding the implementation details from the end user or third party application like Paytm. In java, abstraction can be performed using Access Specifier(public, private, protected, default). We have already learned about access specifier in the previous article. The example in real life: Take a scenario where user visiting e-commerce site like Paytm, netbankingMyntra etc, and after selecting an item he goes for the payment process into his bank net banking. Now in the case of an online transaction, there must be some method defined as  public  inside bank system so e-commerce website can complete their transaction. Also, all the other methods must be declared as  private  or  protected  so that outside user can not access their code just by using inheritance property. By using abstraction property bank system secure their code. Have a look into below code: public class Account { private float amount=10000.f...