Selenium
Difference between / and // in XPath
/ is used to create absolute XPath which starts from root. This is highly brittle since any changes to UI will change element locator.
// is used to create relative XPath . The XPath is created relative to another element in UI
Difference between driver.get() and driver.navigate().to()
Both driver.get()
and driver.navigate().to()
will try to open a webpage and wait for the page to load. It means, it will wait till Onload
event has fired. But it will not wait for all AJAX calls to trigger and process. Both of them are essentially the same. How ever Navigate() interface exposes the ability to move backward and forward in browser history.
1 2 3 4 |
|
Difference between driver.close() and driver.quit()
driver.close() will close the window which is currently accessed by webdriver. driver.quit() will close all windows that are opened by the webdriver during current execution.
Java - Writing Into Specific Cell in Excel
In my previous blog post , I have mentioned how to read from an excel file using jxl jar files in Java. It can be found here
In this post, I will explain how to write into an excel using same library. Below example will update the excel cell content with the value passed and also update its formatting . The color of the cell will change depending on value we pass. We can use similar functions for updating any other cell format.
Below is the import section
1 2 3 4 5 6 |
|
Below is the function for writing into excel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
Java - Reading a Specific Cell in Excel
Below is a code snippet for reading a specific cell from Excel using Java.
It is done by using importing jxl jar files which can be found here.
Import below in class file
1 2 3 4 5 6 |
|
Below is function for reading value from specific cell in Excel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
Below is an example of how to read from a cell based on row number and Column NAME
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|