- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 86 Articles for DOM
![Jaisshree](https://www.tutorialspoint.com/assets/profiles/626154/profile/60_732783-1679645062.jpeg)
387 Views
To write javascript advanced code you can run across instances where you need to convert a DOM (Document Object Model) NodeList to a more adaptable data structure like an array. Although nodelist is just like an array in any programming language. However, it does not contain fever characteristics than an array. You can use Javascript to convert a nodelist into an array to work more appropriately. Example 1 This example provides code to convert a nodelist into an array using javascript. The code uses the nodeListToArray function to perform the conversion. Algorithm Step 1 :Create an array ... Read More
![Shriansh Kumar](https://www.tutorialspoint.com/assets/profiles/644826/profile/60_1575483-1682416785.jpg)
2K+ Views
Both SAX and DOM are a type of XML parser APIs. Here, API stands for Application Programming Interface and Parser is used to read and extract content from an XML document in desired format. From this line, it is clear that SAX and DOM are used to read XML documents. APIs are a modern way to migrate real time information on the Web. In this article, we will discuss the difference between SAX and DOM Parser in Java. Type of XML Parser Before going further in this article, let’s briefly discuss XML and its type. XML Its full form is ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
423 Views
Fluent wait is a dynamic wait which makes the driver pause for a condition which is checked at a frequency before throwing an exception. The element is searched in DOM not constantly but at a regular interval of time.For example, if the wait is for 5 seconds, FluentWait monitors the DOM at regular intervals (defined by polling during time). In FluentWait, customized wait methods based on conditions need to be built.Syntax −Wait w = new FluentWait< WebDriver >(driver) .withTimeout (10, SECONDS) .pollingEvery (2, SECONDS) .ignoring (NoSuchElementException.class)Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.support.ui.Wait; import ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
856 Views
findElement() and findElements() method tries to search an element in DOM.The differences between them are listed below −sl.no.findElement()findElements()1It returns the first web element which matches with the locator.It returns all the web elements which match with the locator.2Syntax − WebElement button = webdriver.findElement(By.name(""));Syntax − List buttons = webdriver.findElements(By.name(""));3NoSuchElementException is thrown if there are no matching web elementsEmpty list is returned if there are no matching elements.ExampleUsing findElements ().import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class RowFindElements { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver ... Read More
![Debomita Bhattacharjee](https://www.tutorialspoint.com/assets/profiles/210947/profile/60_171666-1594382095.jpg)
5K+ Views
We can identify the nth sub element using xpath in the following ways −By adding square brackets with index.By using position () method in xpath.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class SubElement { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; driver.get(url); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); // xpath using position() targeting the first element with type text driver.findElement(By.xpath("//input[@type='text'][position()=1]")) ... Read More
![Ayush Gupta](https://www.tutorialspoint.com/assets/profiles/134135/profile/60_13095-1568350695.jpg)
621 Views
We can use the Node.contains method to do this check. The Node.contains() method returns a Boolean value indicating whether a node is a descendant of a given node, i.e. the node itself, one of its direct children (childNodes), one of the children's direct children, and so on.ExampleFor example, you are looking for an element with id test, you can use the following −const elem = document.querySelector('#test'); console.log(document.body.contains(elem));This will log true or false based on whether the element is present in the visible DOM.
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
69 Views
The HTML DOM borderRight property is used as a shorthand for getting or setting the Right border properties for an element. The borderRight property contains border-Right-width, border-Right-style, border-Right-color.Following is the syntax for −Setting the borderRight property:object.style.borderRight = "width style color|initial|inherit"The above properties are explained as follows −ParameterDescriptionwidthFor setting the Right border width.styleFor setting the Right border style.colorFor setting the Right border color.initialFor setting this property to default value.inheritTo inherit the parent property value.Let us look at an example for the borderRight property −Example Live Demo #P1 { border-Right: 4px solid magenta; ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
185 Views
The HTML DOM borderRadius propert is used to add rounded corners to the element’s four sides. Using this property, we can set and get the border radius properties like borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius.Following is the syntax for −Setting the borderRadius property:object.style.borderRadius = "1-4 length|% / 1-4 length|%|initial|inherit"The property values are explained as follows −ValueDescriptionlengthFor defining the borders shape.%For defining the borders shape in percentage.initialFor setting this property to initial value.inheritTo inherit the parent property valueLet us look at an example for the borderRadius property −Example Live Demo #DIV1{ height: 100px; width: ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
61 Views
The HTML DOM borderLeftWidth property is used for setting or getting the Left border width for an element.Following is the syntax for −Setting the borderLeftWidth property −object.style.borderLeftWidth = "thin|medium|thick|length|initial|inherit"The property values are explained as follows −ValueDescriptionthinThis specifies a thin border.mediumThis specifies the medium border and is the default value.thickThis specifies a thin border.lengthFor setting this property to default value.initialFor setting this property to initial value.inheritTo inherit the parent property valueLet us look at an example for the borderLeftWidth Property −Example Live Demo #DIV1{ height: 100px; width: 200px; border: ... Read More