Compare two arrays of objects and filter out similar property values?

I’m calling two API endpoints: the first one will return an array of clients whose account is currently active with us, and the second will return an array of ALL clients (current and past) regardless of their current status.

I’m creating a dropdown menu that will basically add a client to the “active client” array. To create this dropdown, I need to filter out all clients from the “All clients array” that already exist in the “Active clients array”.

Eg:

ALL clients

[{name: "Martha", id: 1}, {name: "John", id: 2},{name: "Jane", id: 3}, {name: "Mary", id: 4}]

Active clients

[{name: "John", customerid: 2}, {name: "Mary", customerid: 4}]

(Yes, the backend dev did give them different property names)

My new array should obviously be:

[{name: "Martha", id: 1}, {name: "Jane", id: 3}]

I can iterate through this list to populate the dropdown menu and only submit a client to the backend that doesn’t already have an active account with us.

How could I place a responsive, relative position button under JS typewriter text?

I’m new to web dev and am encountering an issue – I have text with a simple JS typewriter effect, and below it is a button with relative position (for responsiveness. Absolute position technically solved the problem on desktop, but on smaller screens, the button ran over the typewriter words.)

When the page first loads, the button jumps around because at first it has nothing to be relative to. Then when the typewriter text appears, the button jumps down really fast. It happens really quickly as soon as the page loads.

Thanks for any insight!

var quoteArray = ["My name is Sam, nice to meet you."];
var textPosition = 0; 
// speed in milliseconds
var speed = 50;
typewriter = () => {
  document.querySelector("#typewriter").innerHTML = quoteArray[0].substring(0, textPosition);
  
  if(textPosition++ != quoteArray[0].length)
    setTimeout(typewriter, speed);
}

window.addEventListener("load", typewriter)
a.linky {

display:inline-block;
padding:0.35em 1.2em;
border:0.1em solid black;
margin:0 0.3em 0.3em 0;
border-radius:0.12em;
box-sizing: border-box;
text-decoration:none;
font-weight:300;
color: black;
text-align:center;
transition: all 0.2s;
}

a.linky:hover {
  background-color: #555;
}

a.linky:active {
  background-color: black;
}

.aboutbuttonposition
{
  text-align: center;
  /*Made position relative to be responsive. */
  position: relative;
  padding-top:  30px;
}

/*Styling typewriter sentence.*/
#typewriter 
{
  font-size: 40px;
  text-align: center;
}
<!--Has corresponding javascript to create typewriter effect-->
<p id="typewriter"></p>

<!-- Messy button div -->
 <div class="aboutbuttonposition">
   <a href="#about" class="linky" id="aboutbutton">About Me</a>
 </div>

How to create a new constructor with each element from my Json file. [Javascript]

Basically this is my Json File:

[ 
  {
    "id": 9,
    "nombre": "ProductoDeJson4",
    "precio": 15000,
    "stock": 0,
    "img": ""
  },
  {
    "id": 10,
    "nombre": "ProductoDeJson5",
    "precio": 15000,
    "stock": 0,
    "img": ""
  }
]

This is my class:

class Producto {
  constructor(id, nombre, precio, stock) {
    this.id = id;
    this.nombre = nombre;
    this.precio = precio;
    this.stock = stock;
  }

  sumaIVA() {
    this.precio *= 1.21;
  }
  aumentarPrecio() {
    if (aumentoPrecios < 1) {
      this.precio = this.precio * aumentoPrecios + this.precio;
    } else {
      this.precio *= aumentoPrecios;
    }
  }
}

And i want to do this dynamically with the data from my Json. Because i want to apply the function “aumentarPrecio()” to each one.

const producto1 = new Producto(1, "Grasa", 400, 1);
const producto2 = new Producto(2, "Desengrasante", 1000, 1);

const productos = [
  producto1,
  producto2, 
];

Right now i’m trying to do it like this but itsn’t working. The new Producto is being created but the functions from the class aren’t working. I think it’s because i’m not creating a new const for each element from the Json. But i don’t know how to do it dynamically.

async function obtenerProductos() {
  const response = await fetch("productos.json");
  return await response.json();
}

let arrayProductos = obtenerProductos();
//Agrego productos del JSON al array de productos (falta agregarle los métodos o transformar cada uno en un new Producto)
arrayProductos.then((el) => {
  console.log(el);
  el.forEach((el) => {
    console.log(el["nombre"]);
    const productosJson = new Producto(
      el["id"],
      el["nombre"],
      el["precio"],
      el["stock"]
    );
    productos.push(productosJson);
    console.log("elemento pusheado");
  });
});
//Método Aumentar precio productos, luego de tener los productos listos en el array
productos.forEach((listaProductos) => {
  setTimeout(() => {
    listaProductos.aumentarPrecio();
    console.log("precios aumentados");
  }, 1000);
});

Please help me, haha. Thanks!

How to open external application in iFrame using JavaScript

I would like to open my external application using iframe. Currently, It works in new window but not sure how to make it work in iframe.

I did some research but could not find proper solution.

Please show me a way to do this. Any help would be much appreciated!

@{   
    string BUrl = ViewBag.BUrl;
    string Token = ViewBag.Token;
    string BResponse = ViewBag.BResponse;
}   
<div id="output"></div>
<div id="divBBackground" style="position: fixed; z-index: 999; height: 100%; width: 100%; top: 0; left:0; filter: alpha(opacity=60); opacity: 0.6; -moz-opacity: 0.8;display:none"></div>

@section Scripts {
    <script>
        $(document).ready(function () {
            $.ajax({
                url: '@BUrl'.replace(/amp;/g, ''),
                type: 'GET',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('Authorization', 'Bearer ' + '@Token');
                },
                success: function (data) {
                    var params = [
                        'height=' + screen.height,
                        'width=' + screen.width
                    ].join(',');                 

                    var popUpB;

                    function showModalPopUp() {
                        popUpB = window.open("", "_blank", params);
                        popUpB.location.href = data.message;

                        popUpB.focus();
                        LoadModalDiv();
                    }

                    function LoadModalDiv() {
                        var bkgB = document.getElementById("divBBackground");
                        bkgB.style.display = "block";
                    }

                    function OnUnload() {
                        if (false == popUpB.closed) {
                            popUpB.close();
                        }
                    }

                    window.onunload = OnUnload;

                    showModalPopUp();
                },
                statusCode: {
                    400: function () {
                        alert("server returned a bad request response.");
                    }
                }                
            });
        });
    </script>
}

Why does concatenating this string before adding it as a parameter to a recursive function cause stack overflow?

function permToN(charList, returnLen, base) {
  if (base.length === returnLen) {
    console.log(base)
  } else {
    for (let char of charList) {
      base += char
      permToN(charList, returnLen, base)
    }
  }
}

permToN(['a', 'b', 'c'], 2, "");

Hi was brushing up on some algorithms and this baffled me. In the above code the problem errs out with Maximum call Stack size exceeded.

However – if I remove the line base += char and make the recursive function call instead with permToN(charList, returnLen, base + char) concatenating the string inside the function param the function works as intended – no stack overflow I am pretty baffled why that small change causes stack overflow. I think I may not understand how the memory is functioning under the hood ? Would greatly appreciate anyone who can explain difference in performance btwn the functions. Below is the function with the concatenation occurring in the params of the function call which works as intended. The above function causes stack overflow. Do not understand the fundamental difference here. thank you!

function permToN(charList, returnLen, base) {
  if (base.length === returnLen) {
    console.log(base)
  } else {
    for (let char of charList) {
      permToN(charList, returnLen, base + char)
    }
  }
}

When searching for a keyword in search field it shows the parents but not the children

I am editing a custom widget but the search functionality is not working as intended so I need a little bit of help. This is a hierarchy custom widget and we are using UI5 to create the Tree View. So the problem is that when I search for a keyword it filters everything that doesn’t contain the characters but shows the parents of the nodes. What is required is actually the reverse, to hide the parents but show the children of the node that contains the characters (what is being searched).

So in a world hierarchy we have planet -> continent -> country -> cities

When searching for “France” I want to see all the cities (ex. Paris, Lyon, Lille, Nice, etc…)

France -> This is being Searched
  Paris
  Lyon
  Lille
  Nice

but right now its showing:

Earth
  Europe
    France -> This is being Searched

If someone can help on this issue I would appreciate the help. This is the code that I am using for the search.

onLiveChange: function (event) {
    const query = event.getParameter("newValue").trim();
    this.byId("Tree").getBinding("items").filter(query ? new sap.ui.model.Filter({
        path: "text",
        operator: "Contains",
        value1: query,
    }) : null);
    this.byId("Tree").expandToLevel(9999);
}

JavaScript in my HTML code won’t work when embedded in Google Sites

I’ve been making a slightly different version of 2048 to embed in my Google Site, but when I try to embed the HTML, the JavaScript part won’t work. When opening the HTML file directly in the browser it does work though.

Here is a link to the code:

https://sites.google.com/view/scoopmungus/html

Here is what the embedded part looks like currently:

https://sites.google.com/view/scoopmungus/fun-and-games/games/2048

Was just wondering what the problem was.

inserting object that matches the property

How do we insert the object 1 to each object on Object 2 below so that each object will have the value from the first object , so the property from Object which are firstMileRange , secondMileRange and thirdMileRange will be replaced with the values from the Object 1.

Any idea guys would be much appreciated. Thanks.

#Object 1 – data or object to insert

[
    {
        "firstMileRange": 1,
        "secondMileRange": 2,
        "thirdMileRange": 3
    }
]

#Object 2 – object to insert the data to

[
    {
        "id": 1521,
        "demographicType": "Demos",
        "demos": "Estimated Population",
        "streetName": null,
        "vehicleCount": null,
        "firstMile": 100000,
        "firstMileRange": null,
        "secondMile": 50000,
        "secondMileRange": null,
        "thirdMile": 50000,
        "thirdMileRange": null
    },
    {
        "id": 1522,
        "demographicType": "Demos",
        "demos": "Households",
        "streetName": null,
        "vehicleCount": null,
        "firstMile": 5999,
        "firstMileRange": null,
        "secondMile": 5999,
        "secondMileRange": null,
        "thirdMile": 5999,
        "thirdMileRange": null
    },
]

#expectedOutput

[
    {
        "id": 1521,
        "demographicType": "Demos",
        "demos": "Estimated Population",
        "streetName": null,
        "vehicleCount": null,
        "firstMile": 100000,
        "firstMileRange": 1,
        "secondMile": 50000,
        "secondMileRange": 2,
        "thirdMile": 50000,
        "thirdMileRange": 3
    },
    {
        "id": 1522,
        "demographicType": "Demos",
        "demos": "Households",
        "streetName": null,
        "vehicleCount": null,
        "firstMile": 5999,
        "firstMileRange": 1,
        "secondMile": 5999,
        "secondMileRange": 2,
        "thirdMile": 5999,
        "thirdMileRange": 3,
    },
]

HTML / JS: Uncaught SyntaxError: Unexpected token ‘.’ when using an older browser [duplicate]

I have a script that retrieves an external JSON. It then checks if a sub-array is empty, and if it is, it does something and moves on. If the sub-array is not empty, it will check starting from 0 each element in the array until it detects that it has finished. Then, it will do something and continue. This is the code that I have:

                var alertCheckNumber = 0
                function checkAlert () {
                    
                    // if there are no alerts
                    if (data?.alerts===undefined) {
                        document.getElementById('allAlerts').style.display = "none";
                        return;
                    }
                    // proceed to check the number of alerts
                    if (data.alerts[alertCheckNumber]?.event===undefined) {
                        finalAlertNumber = alertCheckNumber;
                        var row = [ 0, 1, 2, 3, 4, 5, 6];
                        for (var i = 0; i<row.length; i++) {
                            if (row[i] >= finalAlertNumber) {
                                document.getElementById(`DIValertdescription${row[i]}`).style.display = "none";
                                document.getElementById(`DIValertlocation${row[i]}`).style.display = "none";
                                document.getElementById(`DIValertname${row[i]}`).style.display = "none";
                            }
                        }
                        return;
                    } else {
                        console.log(alertCheckNumber);
                        printAlertData(alertCheckNumber);
                        alertCheckNumber++
                        checkAlert();
                    }
                }

However, the issue in the code is where I have data?.alerts===undefined. This is supposed to check if data.alerts is empty. This works fine in modern browsers, but when I run it in an older browser, like Chrome in Windows 7, I get this error:

Uncaught SyntaxError: Unexpected token '.'

pointing to the line of code I highlighted above.
How might I be able to fix this, so that it is backwards compatible?

Why do I get null characters at the end of my files when encoding and decoding?

I’m making a web app that encodes an input file into a canvas element based on the char codes of each character in the input file.

For instance ABC, being 0x41, 0x42 and 0x43 would make the color code #414243, and so on for the entire file.

A canvas element is then updated with the color codes to create a downloadable image.

To decode, there is a function that goes through each part of the uploaded image file, gets the color code and converts it back into characters based on the color values.

The issue is, I’m getting NUL characters at the end of the decoded file, and I’m at my wits end about how to handle these.

Here’s the full JS code

function getFile (inp, encode=true){
  //no return
  let file = inp.files[0];
  let fr = new FileReader();

  if (encode){
    fr.readAsText(file);
    fr.onload = function(){
      let hexCodes = colorCode (fr.result, file['name']);
      let imgMain = document.getElementById ("main-canvas");
      imgMain.width = hexCodes.length;
      imgMain.height = 100;
      let ctx = imgMain.getContext("2d");
      for (let i=0;i<hexCodes.length;++i){
        ctx.fillStyle = hexCodes[i];
        ctx.fillRect (i,0,i+1,100);
      }
    };
  }else{
    fr.readAsDataURL(file);
    fr.onload = function(){
      var imgTmp = new Image();
      imgTmp.src = fr.result;
      imgTmp.onload = function(){
        let tmpDecode = colorDecode(imgTmp);
        let link = document.getElementById("download-link");
        link.download = tmpDecode[0];
        let tmpBlob = new Blob ([tmpDecode[1]],{type: 'text/plain'});
        link.href = window.URL.createObjectURL(tmpBlob);
      }
    }
  }
  
  fr.onerror = function(){
    console.log (fr.error);
  };
}

function rbg(r,g,b){
  //returns an HTML color code
  let rR = "0"+r.toString(16);
  let rG = "0"+g.toString(16);
  let rB = "0"+b.toString(16);
  rR = rR.substr(rR.length - 2);
  rG = rG.substr(rG.length - 2);
  rB = rB.substr(rB.length - 2);
  return "#" + rR + rG + rB;
}

function colorCode(strInp, strName){
  //returns an array of color codes;
  let colors    = [[],[],[]];
  let colorsHex = [];
  while(strName.length<256)
    strName += String.fromCharCode (0);
  let wholeStr = strName + strInp;
  for(let i=0;i<wholeStr.length;++i){
    colors[i%3].push(wholeStr[i].charCodeAt(0));
  }
  if (colors[0].length>colors[1].length)
    colors[1].push(0);
  if (colors[1].length>colors[2].length)
    colors[2].push(0);
  for (let i=0;i<colors[0].length;++i){
    colorsHex.push(rbg(colors[0][i],colors[1][i],colors[2][i]));
  }
  return colorsHex;
}

function colorDecode(imgInp){
  //returns text value of file
  let imgMain = document.createElement ("canvas");
  let ctx = imgMain.getContext("2d");
  imgMain.width = imgInp.width;
  if (imgMain.width < 256)
    return "Image is not of correct length!";
  imgMain.height = imgInp.height;
  ctx.drawImage (imgInp, 0, 0);
  let retVal = "";
  let name = "";
  for (let i=0;i<86;++i){
    let p = ctx.getImageData(i,10,1,1).data;
    if (p[0] === 0)
      break;
    name += String.fromCharCode (p[0]);
    if (i!==86){
      if (p[1] === 0)
        break;
      name += String.fromCharCode (p[1]);
      if (p[2] === 0)
        break;
      name += String.fromCharCode (p[2]);
    }
  }
  name += String.fromCharCode(0); //ensures it's null terminated
  for (let i=85;i<imgMain.width;++i){
    let p = ctx.getImageData(i,10,1,1).data;
    if (i!==85)
      retVal += String.fromCharCode(p[0]);
    retVal += String.fromCharCode(p[1]);
    retVal += String.fromCharCode(p[2]);
  }
  while(retVal[-1]===String.fromCharCode(0) ||
        retVal[-1]===String.fromCharCode(32))
    retVal = retVal.substr(0,retVal.length-1);
  return [name.substring(0,name.length-1), retVal];
}

And here’s the HTML just in case it’s relevant

<doctype html>
<html>
  <head>
    <title>Color Coder</title>
    <script src="colorCoder.js"></script>
  </head>
  <body>
    <label for="inp">Select a file to convert</label>
    <input type="file" id="inp" onchange="getFile(this)">
    <br>
    <canvas id="main-canvas" height=100></canvas>
    <br>
    <label for="inpDecode">Select an image to decode</label>
    <input type="file" id="inpDecode" onchange="getFile(this, false)">
    <br>
    <a id="download-link" download href="javascript:alert('Nothing to download!');">Download</a>
  </body>
</html>

I know I’m adding char values 0 at the end of the strings, but shouldn’t

while(retVal[-1]===String.fromCharCode(0) ||
        retVal[-1]===String.fromCharCode(32))
    retVal = retVal.substr(0,retVal.length-1);

take care of removing those NUL characters?

I’ve tried changing readAsText to readAsBinaryString, still get similar (the same?) issues.

I’m downloading the images as .PNG, and while I don’t know, it doesn’t look like it’s losing resolution at any point.

Improving efficiency of adding a column to an array in a loop?

So I wrote some code that goes to a book’s ID based on a “dictionary” and takes the data from all the sheets in that book after the second sheet. That data is then aggregated into a single array. My question centers around the idea of improving the for loop in the if statement. That is adding the “supplier name” to the front of the subarray that represents a row in the sheet/data. I was told that this is inefficient as the code has to go through each subarray and add a value.

Is there a more efficient way of doing this? I did it this way because I am copying the values of a range which are stored as an array of arrays. So to add data, I have to reaccess the subarrays. Is it possible to add the new data (supplier name) at the same time that the values are being copied? would this be more efficient? It was recommended to use an arrow function, however, I am not familiar with their usage.

function aggregate() {
   var combinedData = []
   var idArray = {
   "suppliername":"id",
   };
for (var supplierName in idArray){
   var sBook = SpreadsheetApp.openById(idArray[supplierName]);
   var sheets = sBook.getSheets();

   for (var index = 2; index <sheets.length; index++){
      var sheet = sheets[index];
      var dataLength = sheet.getRange("E5:E").getValues().filter(String).length;

      if(dataLength != 0){
         var dataRange = sheet.getRange(5,2,dataLength,14);
         var dataValues = dataRange.getValues();
      
         for (row in dataValues) {
           dataValues[row].unshift(supplierName);
         };
         combinedData = combinedData.concat(dataValues);
      };
   };
};

var dataLength = combinedData.length;
const dSheet = SpreadsheetApp.openById("id").getSheets()[0];
dSheet.getRange(2,1,dSheet.getMaxRows(),dSheet.getMaxColumns()).clearContent();
var dRange = dSheet.getRange(2,1,dataLength,15);
dRange.setValues(combinedData);
};

Can axois implement curl -cacert ?

I want to get the content of curl -cacert <file> <url> in my javascript api with axois. But I am confused where to add the specified certificate file. Or can other libs than axois are able to implement this?

I try to do:

const agent = new https.Agent({ca: fs.readFileSync(<cacert file>),});

var instance = axios.create({ agent: agent });

const response = await instance.get(url);

But it seems not work. Any suggestions for this? Thank you so much!

How to check if a parent object exists to avoid undefined error

I am using the below function to decide if I have new value for a key in my json doc or not. If I do, I go and use the new value, otherwise I use the previously stored value. This works fine if it is a direct value I am referencing, but for example if i use

home_addr.address_line_2 =
updateValue(oldData.home_address.address_line_2,
data.home_address_line_2)

and oldData.home_address does not exists it complains that address_line_2 is undefined. So how can I handle this in a way without having to check if each parent object is created to avoid this error ?

const updateValue = (oldvalue, newvalue) => {
    if (typeof newvalue !== "undefined" && newvalue !== null) {
        console.log("new Value to trim : " + newvalue)

        if (typeof newvalue == "boolean") {
            return newvalue;  
        } else if(typeof value === 'number') {
            return newvalue; 
        }
        else {
            return newvalue.trim();
        }
     
    } else {
        if (typeof oldvalue !== "undefined" && oldvalue !== null){
        return oldvalue;
        } else {
            return null
        }
    }
};

Unable to locate xpath element – Selenium, Python, Chromedriver

I’m new to coding and am trying to automate an onboarding process at my work.

adminB = driver.find_element(By.XPATH, '//*[@id="2rollUpBtnX"]/table/tbody/tr/td')
adminB.click()

^ This code is returning – “NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”xpath”,”selector”:”//*[@id=”2rollUpBtnX”]/table/tbody/tr/td”}
(Session info: chrome=100.0.4896.60)

I’m getting the same error whenever I try to access any element on the page via xpath. I’ve also tried by name and element id. I suspect that all of the elements on the page are being hidden by the body. I have to inspect the element twice on the page to pull up any element. The first inspection pulls up the body, then the second one will pull up the desired element. Here’s what shows up on the first inspection.

<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="./stylesheets/standard.css"><script type="text/javascript" language="javascript" src="./javascript/global.jmf"></script><script type="text/javascript" src="./javascript/cookie.jmf"></script><script type="text/javascript" language="JavaScript">

if (document.cookie)
{
    if (getCookieCount("vmf_ver") == 0)
    {
        DeleteAllCookies();
        setCookie("vmf_ver", "6.9.0.0", "01/01/2099");
    }
    else
    {
        if(getCookieNum("vmf_ver", getCookieCount("vmf_ver")) != "6.9.0.0")
        {
            alert("A new version of MailFlow has been detected!\r\n\r\nPlease clear your browser cache of\r\nall temporary Internet files.");
            setCookie("vmf_ver", "6.9.0.0", "01/01/2099");
        }
    }
}
function docSetLoading(show)
{
    if (show)
    {
        document.getElementById("titlebarstatusoff").style.display = "block";
        document.getElementById("titlebarstatuson").style.display = "none";         
    }
    else
    {
        document.getElementById("titlebarstatusoff").style.display = "none";
        document.getElementById("titlebarstatuson").style.display = "block";
    }
}

</script><title>VisNetic MailFlow</title>

</head><body id="mailflowBody" style="border:1px inset!important;overflow:hidden"><table style="height:100%;width:100%;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="border:1px outset;"><table style="table-layout:fixed;width:100%;background-image:url('./images/gradient.gif');background-repeat:no-repeat;background-color:#a6b1cc;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td width="100%" nowrap="true"><table style="table-layout:fixed;width:100%;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td unselectable="on" id="titlebarmenu" style="overflow:hidden;text-overflow:ellipsis;font-size:12pt;font-weight:bold;color:#FFFFFF;padding-left:6px;height:25px;"><span id="titlebarmenutext" unselectable="on">My Tickets</span></td><td width="199" height="25" align="right"><span id="titlebarstatusoff" style="display: block;"><a href="#" onclick="glo_launchModalWindow('about.ems', 450, 500);"><img src="./images/mailflowwhite.gif" width="199" height="25" border="0"></a></span><span style="padding-right: 6px; display: none;" id="titlebarstatuson"><img src="./images/loading.gif" width="16" height="16" border="0"></span></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr><td style="height:100%;"><iframe id="theMainContain" name="theMainContain" style="width:100%;height:100%;" frameborder="0" scrolling="NO" src="main.ems"></iframe></td></tr></tbody></table>

<xml id="docXML"><root><user><id>558</id>

<useim>1</useim><newmessageformat>0</newmessageformat><useautofill>0</useautofill><outboundapproval>0</outboundapproval><outboundapprover>0</outboundapprover><stylesheetname>./stylesheets/standard.css</stylesheetname><menubackcolor>#D4D0C8</menubackcolor><isadmin>1</isadmin><escalatetoagentid>0</escalatetoagentid><quotemsginreply>1</quotemsginreply><replyquotedprefix>> </replyquotedprefix><forcespellcheck>1</forcespellcheck><signaturetopreply>1</signaturetopreply><showmessagesinbound>1</showmessagesinbound><usepreviewpane>1</usepreviewpane><closeticketaftersend>2</closeticketaftersend><autoroutetoinbox>2</autoroutetoinbox><usemarkasread>0</usemarkasread><markasreadseconds>5</markasreadseconds><defaultticketboxid>1</defaultticketboxid><defaultticketdblclick>0</defaultticketdblclick><readreceipt>0</readreceipt><deliveryconfirmation>0</deliveryconfirmation><statusid>1</statusid><statustext>Online</statustext><onlinetext>Online</onlinetext><awaytext>Away</awaytext><notavailtext>Not Available</notavailtext><dndtext>Do Not Disturb</dndtext><offlinetext>Offline</offlinetext><oootext>Out of Office</oootext><autostatustypeid>2</autostatustypeid><autostatusmin>0</autostatusmin><logoutstatusid>5</logoutstatusid><logouttext>Offline</logouttext><autotext>Away</autotext><access><contact>4</contact><stdresp>4</stdresp><stdreports>4</stdreports><schedreports>4</schedreports><autoopen>4</autoopen><agentaudit>4</agentaudit><voip>4</voip><pref>4</pref><prefgen>4</prefgen><preftb>4</preftb><prefav>4</prefav><prefsig>4</prefsig><prefmydict>4</prefmydict><prefmyfold>4</prefmyfold><prefmyal>4</prefmyal><prefmycont>4</prefmycont><rrtm>4</rrtm><ctas>4</ctas><rrr>4</rrr><rdc>4</rdc></access></user><document><lcid>1033</lcid><title>MailFlow</title><chgnotsavedmsg>Your changes have not been saved!</chgnotsavedmsg><useragent>Chrome</useragent><useros>Windows</useros><serverid>2</serverid><filename>mailflow.ems</filename><usehttps>1</usehttps><allowlogout>0</allowlogout><usevoip>0</usevoip><ticketclose>2</ticketclose><ticketroute>2</ticketroute><updatefreq>300</updatefreq><statusfreq>30</statusfreq><useverification>0</useverification><usedatetime>0</usedatetime><dateformat>0</dateformat><urlparameters></urlparameters></document></root></xml></body></html>

The second inspection pulls up where I am gettingthe xpath from.

I have tried accessing different elements on the page via xpath, element id, and name, but have had no luck.
I’ve also tried simulating a click on the body of the webpage and attempting to find the element after.
Here is my code so far..

import selenium
from selenium.webdriver.common.action_chains import ActionChains 
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:\Users\user.name\Documents\VSCode\Chromedriver\chromedriver.exe")
driver.get("https://website-here.ems") ## I've put in the actual address in my code.

input("Login, then hit enter.")

adminB = driver.find_element(By.XPATH, '//*[@id="2rollUpBtnX"]/table/tbody/tr/td')
adminB.click()

The same script on a different website works as intended.

import selenium
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium import webdriver
driver = webdriver.Chrome(executable_path="C:\Users\user.name\Documents\VSCode\Chromedriver\chromedriver.exe")
driver.get("https://www.python.org/")

input("Login, then hit enter.")

adminB = driver.find_element(By.XPATH, '//*[@id="documentation"]/a')
adminB.click()

Time doesn’t seem to be a factor in this problem. I’ve waited 3-5 minutes before hitting enter after the page loads.
Any pointers on how to proceed would be appreciated.

Ag-Grid: Implement button to get child count

I am demoing the latest Ag-Grid Enterprise and I have implemented the Server Side Row Model successfully, including the ability to send back group child counts such that the grid can display child counts for groups.

However, displaying child counts for every group is incredibly time-consuming for my database to calculate and so not a good default. However, I would like to add a “Count” button or similar next to each group such that then when clicked it will send off enough information to my server side implementation that the child count can be calculated and relayed back.

I can imagine how many aspects of this could work, but primarily I need help understanding how a button could best know the groups it is under (the DOM isn’t exactly laid out in the same nesting structure as the grid itself so getting that information that way doesn’t seem entirely straightforward).

Thanks for your time!