Is there a glitch in the Selenium Java CSS Selector functionality?

Everything seems to be working smoothly with that code! It successfully locates and clicks on my button within the span tag.

driver.findElement(By.cssSelector("span[id$=somePagesCollection] a")).click();

However, after clicking the button, an input field appears.

driver.findElement(By.cssSelector("span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]")).sendKeys("some");

But now I'm encountering an issue:

org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]"} Command duration or timeout: 16 milliseconds

I've checked the outer HTML of the element, but can't seem to figure out what I'm doing wrong.

<input id="s567bb2e58337a_somePagesCollection_0_url" name="s567bb2e58337a[somePagesCollection][0][url]" required="required" class=" form-control" type="url">

For example, in the browser console:

$('span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]').hide() 

Another successful example from the browser console that doesn't work in Selenium:

$('span[id$=somePagesCollection] tr:nth-child(2) td:nth-child(2) input').hide()

Answer â„–1

Make sure to delay sending any data until the element is fully visible

WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]"))).sendKeys("some");

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Struggling to incorporate a Search Filter feature into my React project, unfortunately, it doesn't seem to be functioning correctly. Any assistance would be greatly appreciated. Can anyone lend

Hey there! I'm diving into the world of React and currently working on creating a search filter that fetches data from an API. Despite not encountering any errors in the console, it seems like my search bar isn't functioning properly. Any suggest ...

Utilize the sortable script for dynamically loaded items via AJAX

For the drag and drop feature on my website, I am using jQuery sortable. I have a button that displays results with items on the screen. These items can be dragged and dropped into various sections. The issue I'm facing is that if I include the sort ...

Organizing Pictures in a Gridded Design

My dilemma lies in displaying a set of thumbnail images within a div. The width of the div can vary depending on the screen size. Each image is fixed at 150px * 150px with a padding of 5px. I aim to arrange these thumbnails in a grid layout while ensuring ...

What is the best way to duplicate an entire webpage with all its content intact?

Is it possible to copy an entire page including images and CSS using Selenium? Traditional methods like ctrl + a or dragging the mouse over the page do not seem to work. How can this be achieved with Selenium without requiring an element to interact with? ...

Generate a fresh array of elements and combine the objects that share the same value

Looking to create a new array of objects based on the original specs array of objects. I have searched for similar questions but nothing has solved my issue. const specs = [ { label: 'Brand', value: 'Nike' }, { label: 'Age ra ...

Using RMarkdown to incorporate custom CSS styling in your documents

Having some trouble with my HTML report created from RMarkdown and applying CSS. The browser version displays correctly, but when printed, the styling doesn't come through. Below is an example of the RMarkdown code: --- title: "Table" output: html_ ...

Is there a way to extract information from an HttpClient Rest Api through interpolation?

I am currently facing an issue with a component in my project. The component is responsible for fetching data from a REST API using the HttpClient, and the data retrieval seems to be working fine as I can see the data being logged in the Console. However, ...

Unable to identify the unsuccessful test case

When executing my test cases using Selenium and NUnit, I encounter an issue with saving screenshots. The goal is to save the screenshot in a "Pass" folder if the test case passes, and in a "Fail" folder if it fails. However, currently only passed test case ...

retrieveSourceData(), postmodification of Handsontable with Vue

How can I use getSourceData() after a change event in Vue? I need to access the instance of Handsontable, but I'm not sure how to do that in Vue. Essentially, I need to retrieve all rows that have been edited. For example: const my_instance = this.$ ...

Sharing data from a Provider to a function in React can be done through various methods

After developing an NPM library that contains various utility functions, including one for calling endpoints, I encountered a roadblock when trying to set the Axios.create instance globally. Initially, my idea was to create a Provider and establish a cont ...

Ion-List seamlessly integrates with both ion-tabs and ion-nav components, creating a cohesive and dynamic user interface

On my homepage, there is an ion-list. Sometimes (not every time), when I select an item in this list or navigate to the register page using "this.app.getRootNav().push("ClienteCadastroPage")", and then select an input in the registerPage or descriptionPage ...

Creating mathematical formulas in JavaScript

How can the equation be translated into JavaScript? This is the proposed programming solution, but there seems to be an issue. var MIR = parseFloat(($('#aprrate').val() / 100) / 12); var paymentAmount = (MIR * $('#amounttofinance').va ...

Having trouble applying CSS to multiple classes used in an AJAX call

I'm trying to utilize richfaces for some fast AJAX widgets, but I am encountering difficulties in setting CSS parameters for them. After inspecting the generated code, I found that the elements have the classes "rf-ds" and "rpds". Despite applying st ...

How can I customize a CSS media class?

In my project, I am using a CSS library that includes the following class: @media only screen and (max-width: 480px) { .nav-tabs>li { margin-bottom:3px; } .nav-tabs>li, .nav-tabs>li>a { display:block !important; ...

What is the best way to retrieve an AJAX response in advance of sending it to a template when utilizing DATAT

Recently, I've been working on integrating log tables into my admin panel using the datatable plugin. Despite setting up an ajax call in my datatable, I'm facing issues with retrieving the response before sending it to the table. Here's a s ...

Discover the best way to implement Wait.Until in Selenium when you already have the element using FindsBy

Currently, I am utilizing the Wait.Until method to ascertain whether my page has finished loading or if it is still in the process of loading. The implementation looks like this: protected IWebElement FindElement(By by, int timeoutInSeconds) { ...

Parameter within onClick function that includes a dot

I'm attempting to design a table that enables an onClick function for the Change Password column's items so my system administrator can adjust everyone's password. Each onClick triggers the "ChangePassOpen" function which opens a modal with ...

Extract information using Selenium from the script element

Currently, I am utilizing a script that enables the input of a chassis number and subsequently displays information related to the vehicle. In this process, my objective is to extract specific details including Marque et type, Dénomination commerciale, Va ...

What is the best way to align the bottom of the last child of a flex element?

Current: Desired: Is it possible to achieve this using the flex or grid model, or do I need to reconsider the structure with a different approach? Below is the code snippet: .sections { display: flex; flex-direction: row; flex-wrap: wrap; jus ...

What steps can be taken to avoid including empty tasks in React code?

Is there a way to prevent my application from adding empty tasks? Below is the code snippet for adding a new task to an array. How can I implement a condition to block the addition of empty tasks? This application follows Mozilla's guidelines for a R ...