You must be meticulous when writing code to avoid errors and make sure your programs work, especially when it comes to the syntax of your chosen coding language. Syntax errors in Java m… Read More
(Read this article on the blog)
Last updated on 2023/09/22 to include changes up to JDK 21.
This article is also available in Chinese by Alex Tan.
Since the release of version 8, up to ver… Read More
Using
page.waitForSelector() method, we can wait for the selector certain amount of
time.
Examplepage.waitForSelector("#result", waitForSelectorOptions)
Find the
below wo… Read More
Alessandro InnocenziFollowBetter Programming--ListenShareThe problem with not releasing the resources we use is that over time the server fills up with things to do and can no longer process… Read More
Using
evaluate method and ‘getComputedStyle’ we can get all the styles associated
with an element.
ExampleLocator locator1 = page.locator("#para1");
Map styles1 = (Map)… Read More
Using the
keyboard modifier 'META', we can open the url in a new tab.
ExampleList modifiers = Arrays.asList(KeyboardModifier.META);
clickOptions.setModifiers(modifiers);
page.locato… Read More
Using ‘page.locator(classSelector).allTextContents()’
method, we can get an array of textContent values for all matching nodes.
ExampleList allParagraphs = page.locator(… Read More
Playwright.locator()
method return the locator by a selector.
SignatureLocator locator(String selector)
Locator locator(String selector, LocatorOptions options)… Read More
‘data-testid’
attribute is used to identify a DOM node for testing purposes. 'page.getByTestId()'
method Locate element by the test id. By default, the 'data-testid' attribute
is… Read More
page.getByTitle()
method locate the elements that match to given title.
SignatureLocator getByTitle(String text)
Locator getByTitle(String text, GetByTitleOptions options)
Locator g… Read More
Locator.uncheck()
method uncheck the radio button or checkbox.
Signature
void
uncheck()
void
uncheck(UncheckOptions options)
Example
page.getByLabel("java").uncheck();… Read More
Locator.isHidden
method return true when the element is hidden, else false.
Signatureboolean isHidden()
boolean isHidden(IsHiddenOptions options)
Example… Read More
Socket programming is a way of communicating between two or more computers over a network. It is a fundamental concept in computer networking and is widely used in various applications such… Read More
Locator.filter
method narrows existing locator according to the options.
SignatureLocator filter()
Locator filter(FilterOptions options)
Example
Filter… Read More
Locator.allTextContents()
method returns a list of textContent values for all matching nodes.
allInnerTexts
() vs allTextContents ()
allInnerTexts()
method returns the text, withou… Read More
Locator.tap() method taps the element. Signaturevoid tap()void tap(TapOptions options) Example page.locator("#favoriteColors").locator("option[value=\"red\"… Read More
'page.dragAndDrop()' method drags the source element to the target element. SignaturedragAndDrop(String source, String target)dragAndDrop(String source, String target, DragAndDropOpti… Read More
Using ‘page.selectOption()’ method, we can select multiple items from a select tag. ExampleString valuesToSelect[] = { "red", "green", "yellow" };page.selectOption("select… Read More