Is there a way to identify the Xpath after clicking a button that adds a row to the JQGrid?

Seeking the Xpath for the Row that was added upon clicking a button. Need to click on the datepicker in the first row and first column to select a date. How can I locate the Xpath for this date picker element? See my code snippet below

        `<table id="list" class="ui-jqgrid-btable" cellspacing="0" 
         cellpadding="0" border="0" style="border: 0px none ! important; 
         width: 2205px;" tabindex="0" role="grid" aria-multiselectable="false" aria-labelledby="gbox_list">
         <tbody>
        <tr class="jqgfirstrow" style="height:auto" role="row">
        <td style="height:0px;width:100px;" role="gridcell"></td>
        ... (more table rows) ...
        <td style="height:0px;width:150px;display:none;" role="gridcell"></td>
       </tr>  
       <tr id="1" class="ui-widget-content jqgrow ui-row-ltr   ui-state- 
       highlight disableRow" tabindex="0" role="row" aria-selected="true"
       editable="1">
       <td rowspan="1" aria-describedby="list_effectiveDate" style="" role="gridcell">
       <input id="1_effectiveDate" class="editable hasDatepicker border-
       red" type="text" name="effectiveDate" style="width: 98%;"  role="textbox" readonly="readonly"></td>

`

Tried the following code:

      `driver.findElement(By.xpath(".//*[@id='1']/td[1]")).toString();
       driver.findElement(By.id("1_effectiveDate")).click();
       driver.findElement(By.xpath(".//*[@id='ui-datepicker-div']/table/tbody/tr[5]/td[2]/a")).click();`

Answer №1

Have you considered using JQuery as an alternative? By doing so, you can avoid the need for XPath and instead manipulate DOM elements directly.

Furthermore, before attempting to click on the calendar, have you verified if it's necessary? Perhaps you could simply input the desired value without interacting with the calendar itself. It seems like the calendar is linked to a text field in the background. If you determine the date format it accepts, you may be able to input the value directly into the textbox without simulating clicks or other actions.

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

Complete the modal window form

I'm currently facing an issue with populating a modal window form. To provide some context, when I click on a grid row to edit a user, I make an ajax call which fetches specific data related to that user. Here is the existing code snippet: <modal ...

Utilize a viewpoint alteration alongside a floating effect on a specific element

I thought this would be an easy task, but I seem to be missing something as it doesn't work for me. The goal is to use the perspective() and rotateY() functions in a transform to create a perspective effect on an element. Additionally, there should b ...

Utilizing SetInterval for dynamically changing the CSS background image URL

I'm starting to feel frustrated with this situation... I have a solution where the CSS background is coming from a webservice. Currently, the system refreshes the entire page using HTML: <meta http-equiv="refresh" content="300" /> ... body { ...

Using Javascript to retrieve form data from a separate file

I am struggling with my HTML and JavaScript files to collect data. Despite my efforts, the function is not executing properly. Below is the code I have been working on: HTML File : <form class="form-newsletter"> <div class="form-group"> ...

retrieve JSON object from deferred response of AJAX request

After utilizing Ajax to send an item to a SharePoint list, I aim to incorporate the jsonObject received in response into a list of items. Located in AppController.js $scope.addListItem = function(listItem){ $.when(SharePointJSOMService.addListIte ...

What is the best way to export Class methods as independent functions in TypeScript that can be dynamically assigned?

As I work on rewriting an old NPM module into TypeScript, I encountered an intriguing challenge. The existing module is structured like this - 1.1 my-module.js export function init(options) { //initialize module } export function doStuff(params) { ...

Remove the preset text in an input field by clicking on it

Looking for help: <input name="Email" type="text" id="Email" value="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92f7fff3fbfed2f3f0f1bcf7eaf3ffe2fef7">[email protected]</a>& ...

javascript mobile nav event

My website utilizes a bootstrap feature for mobile devices where a left sidebar pops up when clicking a button. I am not very familiar with bootstrap, but I would like to link a javascript event to determine if the left sidebar is visible. How can I achiev ...

Include a new route in the Vue.js router dynamically during runtime

I am in the process of developing an application and I want to incorporate extensions into it. These extensions will have their own Vue components, views, and routes. Instead of rebuilding the entire app, I am looking for a way to dynamically add these new ...

Enhancing Redux efficiency with substantial data structures

I have developed a web application using Redux and React. It is an analytics application that displays a significant amount of data. However, I am facing performance issues as the size of my data store increases. What is the best approach to prevent perfo ...

Tips for Dynamic Importing and Rendering of Components in ReactJS

I'm looking to dynamically import and render a component in React. I have two components - Dashboard and Home. Essentially, I want to dynamically render the Dashboard Component inside the Home Component without having to import it beforehand or maybe ...

The npm start command is no longer functioning in Angular 5

When attempting to start angular 5 with npm, I encountered an error that reads: TypeError: callbacks[i] is not a function Can anyone shed some light on where this error might be coming from? It seemed to pop up out of the blue and I can't seem to ...

What are some methods for identifying a single attribute element that is duplicated elsewhere on a webpage?

<html> <tr id="userman-orgchart-tree-node-9" class="fancytree-expanded fancytree-folder fancytree-has-children fancytree-exp-e fancytree-ico-ef"> <td> <span class="fancytree-node" style="padding-left: 16px;"> <span class="fancytr ...

Look up smartphones, select a specific model, and display a specific product review on the console

While attempting to extract and print a specific review of a mobile product from Amazon using Selenium with Java within the Cucumber framework, the output in the console appears to be blank. @Then("Click on the add to cart button") pu ...

What's the process for setting a value in selectize.js using Angular programmatically?

Currently, I am implementing the AngularJS directive to utilize selectize.js from this source: https://github.com/kbanman/selectize-ng In my scenario, I have two dropdowns and my goal is to dynamically populate one of them called selectizeVat based on the ...

Why is the JavaScript code not functioning when the page loads?

Here is the HTML code snippet: <head> <link href="/prop-view.css" media="screen" rel="stylesheet" type="text/css"> <script src="/javascripts/jquery-1.3.2.min.js" type="text/javascript"></script> <script type="tex ...

Obtain the refined information from a UiGrid table

Is there a way to loop through the filtered rows in an uigrid? I am aware that we can get the filtered rows using the following code: var filteredData = $scope.gridApi.core.getVisibleRows($scope.gridApi.grid); However, I need to iterate through it and cr ...

Interval function failing to update information on Jade template

Currently, I am working on a Node app using Express and Jade. My aim is to retrieve JSON data from an API and have it refresh on the page periodically. To achieve this, I have created an empty div where I intend to inject the contents of a different route/ ...

Having trouble retrieving information from Node.js service in AngularJS 2

I am currently expanding my knowledge of Angular and attempting to retrieve data from a node js service using Angular 2 services. When I access the node js services directly from the browser, I can see the results. However, when I attempt to fetch the dat ...

Is there a way to duplicate a GLTF model that has been imported into the Autodesk Viewer?

I encountered an issue while trying to dynamically clone a loaded GLB model and allow the user to position it in the scene. Despite using the model.clone() method, the cloned model ends up appearing at the same position as the original, causing changes in ...