Finding locators in selenium

Before performing any operation on any web element or any web component we need to tell the web driver where exactly that element resides on the web page. We can see the web element with our eyes but webdriver can’t. We need to tell it, that go to this particular location and perform this particular operation. To do so we make use of XPath. XPath is the XML path of a web element in the DOM. When you visit a website in google chrome and right click on the web page and select “view source”, you’ll see an HTML page with huge chunks of HTML, CSS, javascript code. You’ll find that the web page is developed with huge chunks of HTML tags

Some common HTML tags are:

div=division
span=span
p=paragraph
a=anchor tag
tr=table row
td=table data
ul=unordered list
li=list item
ol=ordered list
h=heading
label
input
and so on.

These elements also have some attribute and their corresponding attribute values.

For e.g. a div tag also has a ‘class’ attribute, or ‘id’ attribute, etc. An anchor tag ‘a’ must have an ‘href’ attribute. These attributes must have some values like class name, or id name.

So we can make use of these elements to find the xpath of our web component. You can find xpath without using any additional addon like firebug or firepath. Open the website in google chrome and right click on the element for which you want to find the xpath and click inspect element.
Now on the inspect element window press ctrl+s.

The basic format of xpath is

//tag[@attribute name="attribute value"]

Suppose there is a division in html whose class attribute value is “abcd”, so we’ll write like this: //div[@class="abcd"]
It means, find a division tag in the html whose class attribute value is “abcd”.

If we write like this //*[@class="abcd"] i.e. putting an asterisk in place of tag, this means, find any tag in the html whose class attribute value is “abcd”.
If we write with a dot operator like .//*[@class="abcd"] here the dot represents the child node. It means the processing starts from the current node. To be more precise find any tag in the html whose class attribute value is “abcd” and start processing from current node. If we do not use dot and simply write //*[@class="abcd"] then it will search class with value “abcd” in the entire document.
If you further want to go inside a parent tag, then you can use a single slash in the middle of the xpath //div[@class="abcd"]/ul/li/a this means under the parent division whose class value is “abcd” find an achor tag which is under ul and li tags. All these xpaths represents either an element or a list of elements on the web page.

XPATH AXES

Axes are the methods used to find dynamic elements. There are instances when you’ll find that the attribute of an html tag gets changed. Due to this your previously written xpath won’t work if the attribute value of any of the tag gets changed. To overcome this, xpath axes have been introduced. These are nothing but the functions which can be used inside our xpath to fetch the correct location even if the attribute is dynamic. The first such function is

1. contains().

suppose there is an attribute value “btn123″, and the numeric figure keeps changing, the numeric part is not constant it keeps changing. so you can write .//*[contains(@name, 'btn')] this means find any tag starting from the current node whose name contains “btn”. OR and AND: You can use ‘or’ or ‘and’ inside your xpath. For e.g. //*[@type='submit' or @name='abcd'], this means select any tag whose type is submit or name is “abcd”. //*[@type='submit' and @name='abcd'], this means select any tag whose type is submit and name is “abcd”. The satisfaction of both conditions is necessary.

2. starts-with()

//label[starts-with(@id,'abcd')]
It means find a label whose id starts with “abcd”.

3. text()

.//td[text()='abcd']

4. following:

Find all elements in the DOM starting after a particular node For. e.g.
//*[@class='post-content']//following::a This means find all the anchor tags after ‘post-content’ class.

You can see, it is giving 18 anchor tags after ‘post-content’ class.

But what if you want a particular tag? For this you can specify the index as below.

5. ancestor:

Find all elements in the DOM starting before a particular node For. e.g.
//*[@class='logoCotainer']//ancestor::div
This means find all the div before ‘logoCotainer’ class.

6. descendant

All elements after current node
//*[@class='uppermenubar']//descendant::div
This means find all div after ‘uppermenubar’ class.

7. preceding

//*[@class='navigation']//preceding::div
This means find all div before class “navigation”

8. child

//*[@class='uppermenubar']//child::div
This means find all child divisions (div) of class ‘uppermenubar’

9. parent

//*[@class='navigation']//parent::div
This means find parent div of ‘navigation’ class

Now that xpaths are being found, you can now use them in your selenium script as below
driver.findElement(By.xpath(“//*[@class='navigation']//parent::div”));
Here By.xpath(“//*[@class='navigation']//parent::div”) will return a By class object. So ultimately we are passing a By class object in findElement method.

SUMMARY

In this lecture, we’ve learned that before performing any operation on the web elements, first, we need to find the exact location or path of that web element and instruct the web driver to go to this path and perform a particular operation. Unless we find the location or path of the web elements how can we instruct our web driver to perform a particular operation on that particular element? For e.g you want to click a button on the web page, or you need to input some text in the text field. First, you need to find where exactly that element is present on the web page. To do so, we can find the tags, attributes, values of those web elements from the page view source and write our xpath

Gefitinib 250mg

Firstly, Geftinat 250mg Tablet is used in the treatment of non-little cell breakdown in the lungs. It is used in patients in which it has spread to various bits of the body, who have atypical epidermal advancement factor receptor (EGFR) characteristics, and who have not had past treatment for the illness. Geftinat 250mg Tablet can be taken with or without food, yet better to have it at a similar time every day for better results. Therefore, The term of treatment changes as shown by your need and response to treatment. You should take it correctly as your doctor has admonished. Misconstruing it in or taking an extreme measure can cause extraordinary outcomes. Moreover, It may require a short time or months for you to see or feel the favorable circumstances yet don’t stop taking it aside from if your essential consideration doctor encourages you to. However, The most broadly perceived consequences of this medicine consolidate disorder, rash, heaving, and weight decrease. It may cause extraordinary detachment of the guts, drink a ton of fluids, or talk with your essential consideration doctor if it bothers you.

USES OF GEFTINAT TABLET
Non-little cell breakdown in the lungs

BENEFITS OF GEFTINAT TABLET
In Non-little cell breakdown in the lungs However, It is a solid and hurtful medicine and you should discuss the perils and preferences with your PCP.

SIDE EFFECTS OF GEFTINAT TABLET
Moreover, Most outcomes needn’t bother with any clinical thought and disappear as your body adapts to the prescription. Essential manifestations of Geftinat The runs Dry skin Loss of desiring Nausea Rash Stomatitis (Bothering of the mouth) Heaving Inadequacy Weight decrease

HOW TO USE GEFTINAT TABLET
Most importantly, Take this medicine in the bit and term as incited by your essential consideration doctor. Swallow down it as a whole. Make an effort not to nibble, squash, or break it.

HOW GEFTINAT TABLET WORKS
Geftinat 250mg Tablet is an adversary of danger solution. It works by discouraging the movement of the unusual protein that signals danger cells to copy. Moreover, This helps with ending or moderate the spread of threatening development cells.

Disclaimer
If you are looking for the best place to buy Gefitinib 250mg online, Asmointernational is the place for you. You can be sure of what you are buying from us as we are recognized as one of the best wholesale pharmacies and we have people buying different types of products including this one from all over the world. Moreover, You will find that our Gefitinib 250mg price is one of the most reasonable you can get anywhere in the world. Asmointernational is a leading wholesale supplier and exporter to China, Russia, the USA, UK, Philippines, Singapore, Thailand from India. We are consistently working towards improving the lives of people with complex conditions and chronic ailments by supplying generic drugs or ethical drugs at affordable prices. Hence, If you wish to order medicine online from India at an affordable price, you can call us at +91-7011394182 or email at [email protected]

Ayurvedic Supplements To Boost Immunity And Reduce Frequency Of Common Cold

Body has a defense mechanism which protects one from virus, bacteria attack and infections. Those who eat healthy and do regular exercise have strong immunity. Nutrient deficiency lowers down antibody production by body cells. Immunity becomes weak in the following conditions:

1. Those who eat sugary foods a lot not only gain weight but sugar also hamper the ability of white blood cells to fight bacteria for the next few hours.
2. Not drinking enough water creates less urine and it is necessary to produce urine in optimum amount as toxins flush out of body with urine only. Presence of toxins in body also create problem in overcoming illnesses.
3. Increase in weight causes hormone imbalance and inflammation which impair the ability of immune system to fight infections.
4. Dryness in nose allows virus to enter in body easily without getting trapped in mucus in nose.
5. Stress and tension for long time weaken the response of immune system.

One can use Imutol capsules which are powerful ayurvedic supplements to boost immunity. These supplements provide vital nutrients which are essential for running functions of body. This also helps one to overcome various deficiencies which affect the defense mechanism of body. These supplements improve absorption and metabolism of nutrients in order to supply energy to body cells which produce antigens and develop muscles. With increase in blood circulation, production of antibodies increases. Frequency of illness reduces which prevent fluctuations in healthy growth of a person. These supplements improve functions of spleen, tonsils, lymph nodes and bone marrow which are involved in maintaining defense mechanism of body.

One also gets relief from weakness that happens when one falls sick. Also, regeneration of cells and tissues get speed up which help in fast healing of wounds, cuts, injuries, etc. One also gets protection from toxins and free radicals which cause cellular damage. Bowel movements become regular with which toxins from body are excreted regularly and this is also supportive in increasing immunity of body.

These ayurvedic supplements to boost immunity contain the following herbs:

1. Tulsi – It contains antioxidants and vitamins which improve respiratory system, fight infections and pathogens and detoxify body in order to balance various body functions. It also helps to reduce frequency of common cold naturally.
2. Kutki – This herb purifies blood, enhances cellular growth, speeds up tissue regeneration and keeps body organs healthy. This herb is an antibiotic which possesses anti-bacterial, anti-microbial and anti-inflammatory properties.
3. Shatavari – It promotes overall well being and health. It also provides nourishment to brain cells and helps to produce a fluid that supports brain to govern body functions. Hence it is included in making ayurvedic supplements to boost immunity.
4. Abhrak bhasma – This herb increases red blood cell count and oxygen carrying capacity of RBC’s. It is an excellent nerve tonic and cellular regenerator.
5. Chitrak – It improves metabolism and this produces more energy for brain cells. It improves antioxidant action and this prevents damage to brain cells from free radicals and toxins.
6. Suvarna bhasma – This ingredient nourishes neurons and increases brain power.
7. Kesar – It promotes overall well-being of a person and its active components prevent effects of free radicals in body.
8. Anantmula – It treats disorders related with gas, heat and metabolism in body.

These herbs are mixed with extracts of Haridra, Daruharidra and Nimba to produce Imutol capsules which are effective ayurvedic supplements to boost immunity. Use these ayurvedic supplements for 3 to 4 months regularly to achieve long lasting results.