> For the complete documentation index, see [llms.txt](https://gyansetu-selenium.gitbook.io/selenium-testing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyansetu-selenium.gitbook.io/selenium-testing/importing-java-doc-into-eclipse.md).

# Importing java doc into eclipse

#### &#x20;Importing java doc into eclipse

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl2IIHeVqLNSxwrdqu%2Fimage.png?alt=media\&token=6cb6c28d-8bd9-4870-9d44-05ed4524efb0)

* &#x20;Right click on your project->properties->java build path
* &#x20; Go to the libraries tab-> Select and expand Selenium server jar File&#x20;
* &#x20;Select Javadoc Location->Click on Edit&#x20;
* &#x20;Now Paste the URL and remove “index.html” part.&#x20;
* &#x20;Validate and Click on OK. Apply->OK

#### &#x20;Program-41

How To Get X Y Coordinates Of Element

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl2i23-cgEkSFriofk%2Fimage.png?alt=media\&token=e93a8758-8108-4455-a9be-ee284c533d2e)

#### &#x20;Program-4**2**&#x20;

&#x20;Zoom In And Zoom Out Page

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl2vk9j7wLJ8lgzUbp%2Fimage.png?alt=media\&token=38b340c4-690a-454c-bc60-0be9cf111aa7)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl30-0fF6tSEd3lqur%2Fimage.png?alt=media\&token=f41a7b75-0c8c-447c-8a97-09fa18b59e22)

&#x20;DesiredCapabilities Class

&#x20;The desired capability is a series of key/value pairs that stores the browser properties like browsername, browser version, the path of the browser driver in the system, etc. to determine the behaviour of the browser at run time.

&#x20;It is used to configure the driver instance of Selenium WebDriver. We can configure all driver instance like FirefoxDriver, ChromeDriver, InternetExplorerDriver using desired capabilities.&#x20;

#### Program-4**3**&#x20;

Set Proxy Settings in Selenium WebDriver (Manual Proxy Configuration)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl3PP--oj1z0IZJaNB%2Fimage.png?alt=media\&token=3ec6bdcd-f848-4b97-91c7-bcac122e2a5c)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl3TbORaIpYNMUBdEf%2Fimage.png?alt=media\&token=b2039543-978b-427b-832b-7aa0866ca263)

#### &#x20;Program-4**4**

&#x20;Handling Cookies in Webdriver

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl21msELRYooO7lTzN%2F-LTl3cKURjLs8yj8VGuO%2Fimage.png?alt=media\&token=4c5fcb6a-3ecf-4e3e-b7e5-8e1ef41a372c)

#### &#x20;Program-45

&#x20;Highlight elements in Selenium Webdriver during script execution

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl4Rw6UAuSpm-IkvmT%2Fimage.png?alt=media\&token=58380e2b-7406-4645-9fae-5d91562cd46d)

#### &#x20;How to generate log files How to configure log4j&#x20;

#### What is Log File?

&#x20;The log file is a just simple file (Any file whose extension is .log will be considered), which keeps track of the record or event or info when any event happens or any software run. This whole process is known as logging.&#x20;

#### Why is it required in Selenium?

&#x20;We can create a log file for our simple script also so we can track or debug our script easily if anything goes wrong in the script. For example, if our script is failing at some point then we can track back what went wrong.

&#x20;What is log4J Log4j is free open source tool given by Apache foundation for creating log files It helps us to generate a log file in various output target.&#x20;

#### How to create log files in selenium

&#x20;Step 1- Download log4j jar file (<https://logging.apache.org/log4j/1.2/download.html)&#x20>;

Step 2- Add log4j to your current project Select your project > Right click > Click on build path> Click Configure build path> Go to library section > Add external jar file > select the log4j > click on Ok

&#x20;Step 3- Open notepad and copy the below code and save the file as log4j.properties.

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl4qLZLr8BeGUQeMsD%2Fimage.png?alt=media\&token=e0f92970-2184-4044-a77a-1d281405c34c)

#### &#x20;Properties file examples

&#x20;Java properties file is used to store project configuration data or settings

#### &#x20;Reading a properties fil

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl53nbiBUf1OKZNUfb%2Fimage.png?alt=media\&token=fa9e0244-038e-4a38-b0f6-209203c6abcc)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl583HUc989o_Bd1lk%2Fimage.png?alt=media\&token=aa1eed84-7972-458b-bb65-7e8404211497)

#### &#x20;Write to properties file

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl5W5V0gWEAUxBdVKs%2Fimage.png?alt=media\&token=791a17c2-7b56-4517-b18e-6b70fd0db0d5)

#### &#x20;Read write Excel File

&#x20;Reading an excel file

&#x20;Reading an excel file is also very simple if we divide this in steps.&#x20;

1\. Create workbook instance from excel sheet

&#x20; 2\. Get to the desired sheet&#x20;

3\. Increment row number&#x20;

4\. iterate over all cells in a row

&#x20;5\. repeat step 3 and 4 until all data is read

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl5ux_zTDJK73QIISp%2Fimage.png?alt=media\&token=7f005c88-e9d5-4544-94b7-3a8f7c9f41c7)

#### &#x20;Read Excel file which have formula cells

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl64vEJSrsDMXWOcXg%2Fimage.png?alt=media\&token=49c3e90c-ff4e-4b5d-a0a0-7d05a415ecc0)

![](https://106491783-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTW0eWU2biq082hmKEn%2F-LTl3mmGcIWbzlvARthx%2F-LTl6AMn1_RDAQHjESWN%2Fimage.png?alt=media\&token=9fc3bc5b-c956-4ff3-a71b-c5a9432fd3ba)
