Selenium RC Separate Drivers for Each Browser

Adiya Dua
Updated on 30-Jul-2019 22:30:26

131 Views

Before we answer the above question, let's understand the architecture on which the selenium RC works upon. RC uses a JavaScript Program called the Selenium core which controls the browser. It works by intimating the user action as commanded by the JavaScript commands but that does not enforce user to write automated test cases in the only JavaScript, let’s see how does RC make that happen.The above diagram depicts the brief architecture of the Selenium RC. (Image Courtesy: www.seleniumhq.org )Now as it is evident that the application under test was being executed on a different system, we can say that selenium ... Read More

Convert Numbers to Millions and Billions Format in MySQL

Chandu yadav
Updated on 30-Jul-2019 22:30:26

1K+ Views

You can use FORMAT() from MySQL to convert numbers to millions and billions format. Let us first create a table−mysql> create table DemoTable    (    Value BIGINT    ); Query OK, 0 rows affected (0.74 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(78000000000); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(10000000000); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(90000000000); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(450600000000); Query OK, 1 row affected (0.41 sec)Display all records from the table using select statement ... Read More

MySQL Query to Search Exact Word from String

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

2K+ Views

To search exact word from string, use the below syntax −select *from yourTableName where yourColumnName regexp '(^|[[:space:]])yourWord([[:space:]]|$)';Let us first create a table −mysql> create table DemoTable    (    Title text    ); Query OK, 0 rows affected (0.23 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('This is the Introduction to Java'); Query OK, 1 row affected (0.05 sec) mysql> insert into DemoTable values('This is the Introduction to MongoDB'); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable values('This is the Introduction to MySQL'); Query OK, 1 row affected (0.06 ... Read More

Make a Canvas in Java Swing

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

3K+ Views

To make a canvas with Java Swing, use the Graphics2D class −public void paint(Graphics g) {    Graphics2D graphic2d = (Graphics2D) g;    graphic2d.setColor(Color.BLUE);    graphic2d.fillRect(100, 50, 60, 80); }Above, we have created a rectangle and also added color to it.The following is an example to make a canvas in Java −Examplepackage my; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo extends JPanel {    @Override    public void paint(Graphics g) {       Graphics2D graphic2d = (Graphics2D) g;       graphic2d.setColor(Color.BLUE);       graphic2d.fillRect(100, 50, 60, 80);    }    public ... Read More

Dynamically Build MongoDB Query

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

2K+ Views

To build query dynamically, you need to write some script. Let us first create a collection with documents −> db.dynamicQueryDemo.insertOne({"Name":"John", "Subject":["MongoDB", "MySQL"]}); {     "acknowledged" : true,     "insertedId" : ObjectId("5cef5c5def71edecf6a1f69a") } > db.dynamicQueryDemo.insertOne({"Name":"John", "Subject":["C", "C++"]}); {     "acknowledged" : true,     "insertedId" : ObjectId("5cef5c73ef71edecf6a1f69b") } > db.dynamicQueryDemo.insertOne({"Name":"John", "Subject":["MongoDB", "Java"]}); {     "acknowledged" : true,     "insertedId" : ObjectId("5cef5c8bef71edecf6a1f69c") }Display all documents from a collection with the help of find() method −> db.dynamicQueryDemo.find().pretty();This will produce the following output −{    "_id" : ObjectId("5cef5c5def71edecf6a1f69a"),    "Name" : "John",    "Subject" : [       ... Read More

1's and 2's Complement of a Binary Number

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

5K+ Views

Binary Number is expressed in base 2. It uses only two digits ‘0’ and ‘1’. Each digit in a binary number is a bit.Sample binary Number − 01000101111’s ComplementOne's complement of a binary number is obtained by reversing the digits of the binary number i.e. transforming 1 with 0 and 0 with 1.Example1’s Complement of 101100 = 0100112’s ComplementTwo’s complement of a binary number is obtained by adding one to the one’s complement of a binary number i.e. 1’s complement + 1.Example2’s complement of 101101 is 010011.Example CodeCode to find One’s and two’s complement −#include #include using namespace std; ... Read More

What Can Selenium WebDriver Do?

Adiya Dua
Updated on 30-Jul-2019 22:30:26

415 Views

Selenium’s Webdriver is an automation testing tool. It can help us automate a task that was otherwise done by people.Anywhere there is a need for a human to repeat an action; we can put selenium to use.Below are the some basic and most common usages of selenium −Automation TestingIt automates web application testing by imitating the user action on a web application using selenium commands. It imitates real actions by handling mouse and keyboard events. WebDriver talks to the OS directly using the OS’s native capability. It uses browser driver for this communicationPerformance TestingBy putting the Selenium Grid to use, ... Read More

Update MySQL Column with Random Value

George John
Updated on 30-Jul-2019 22:30:26

2K+ Views

To update column with random value, you can use the below syntax−update yourTableName set yourColumnName =round(1+rand()*100);The above syntax will generate a value between 1 to 100. Let us see an example and create a table−mysql> create table DemoTable    (    Number int    ); Query OK, 0 rows affected (0.46 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(80); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(100000); ... Read More

GetMaxCharLiteralLength Method in Java DatabaseMetadata

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

125 Views

The getMaxCharLiteralLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows for a character literal.This method returns an integer value, representing the maximum length of a character literal. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. ... Read More

Select and Add Result of Multiplying Two Columns in MySQL

Anvi Jain
Updated on 30-Jul-2019 22:30:26

840 Views

You can use aggregate function SUM() for this. Let us first create a table −mysql> create table DemoTable    (    CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    CustomerProductName varchar(100),    CustomerProductQuantity int,    CustomerPrice int    ); Query OK, 0 rows affected (0.17 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(CustomerProductName, CustomerProductQuantity, CustomerPrice) values('Product-1', 5, 400); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(CustomerProductName, CustomerProductQuantity, CustomerPrice) values('Product-2', 3, 100); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(CustomerProductName, CustomerProductQuantity, CustomerPrice) values('Product-1', 2, 300); Query OK, 1 ... Read More

Advertisements