NTLM in CYPress

I want to access a link that is protected with username and password through a windows authentication popup.

I read that this requires an NTLM plugin for CYPRESS. I want to access a form link https://etc.domain.com/dirlisting/notifications and here i want to login

 it('loginpopup', () => {
    cy.ntlm(["https://etc.domain.com/dirlisting/notifications"], "Administrator", "password");
    cy.visit("https://etc.domain.com/dirlisting/notifications");
  })

I tried this code but i have error: “Invalid host [https://etc.domain.com/dirlisting/notifications ] in ntlmHosts, must be one of: 1) a hostname or FQDN, wildcards accepted. 2) hostname or FQDN with port, wildcards not accepted (localhost:8080 or www.google.com or *.acme.com are ok, https://www.google.com:443/search is not ok).

I tried also without https

I tried cy.visit('https://username:[email protected]') but isn’t work

Rewrite vanilla JS forEach into jQuery Each()

I am trying to keep my code consistent as I’m using jQuery for my project, however, I’m a bit confused about the each() method of jQuery.

let cells=$(".cell").toArray();

my Vanilla JS code is here:

cells.forEach(function(cell,index){
    cell.addEventListener('click',function(){
        console.log(cell,index);
    })
})

my jQuery is here:

cells.each(function(index,cell){
    cell.click(function(){
        console.log(cell,index);
    })
})

I know the code is wrong, as the console shows Uncaught TypeError: cells.each is not a function but I checked the jQuery Document, it says the each method is the forEach method in JS, I am really confused now.

display input value in div

I have an input with values and I want to add a value to a div every time I select it.

so that I can add more than one value

Thanks in advance.

HTML

<div [formGroup]="form">
 <select name="test id="test">
   <option value="one">One</option>
   <option value="two">Two</option>
 </select>
</div>

// i want display the input value here

<div> {{this.form.value}} </div> // this way does not work

JavaScripts read an array that was sent from PHP

Hello I am starting to use JavaScript, I explain my problem, i send array to give from PHP to my JavaScript but when I want to read my array in JavaScript, it reads letter by letter and not words by words.

erreur image

function update(json)
{

    console.log(json);
    var result = JSON.stringify(json);
    console.log(result);

    for (let i =0;i< result.length;i++)
    {
        chart.data.datasets[0].data[i]=result[i];
        console.log(result[i]);
    }
    chart.update();
}
<button data-values="<?php  echo preg_replace('/"/',"'", preg_replace("/'/","'", json_encode($tab[$row]))); ?>" onclick="update(this.getAttribute('data-values'))"><?php echo $worksheet->getCell('A'.$row)->getValue(); ?></button>

How do you fetch data from an API and inject that same data into a link that points to another API (JavaScript)

The movie.imdbID return a string of IDs which is then used as an argument for the getMovieIMDBID function. In my code when the element is created, it looks fine as the id looks to be properly inserted like so

a onclick=”getMovieIMDBID(tt4853102)”>Batman: The Killing Joke

yet on the console it tells me ReferenceError: tt4853102 is not defined when i click on the UI.

and if I ctrl+click the link i get this error message in a pop up window

{“Response”:”False”,”Error”:”Conversion from string “${movieID}” to type ‘Double’ is not valid.”}

let movies = movieItems.map(function (movie) {
   return `  <a onclick="getMovieIMDBID(${movie.imdbID})">${movie.Title}</a> 
                <img src="${movie.Poster}">

              `;
    });

function getMovieIMDBID(movieID) {
  let movieInfo = new XMLHttpRequest();
  movieInfo.addEventListener("load", function () {
    let movieInfoParsed = JSON.parse(this.responseText);
    let movieInfoItems = movieInfoParsed.map(function (data) {
      return `<h1>${data.Title}</h1>`;
    });
    movieInfoContainer.innerHTML = movieInfoItems;
  });
  movieInfo.open(
    "GET",
    `https://www.omdbapi.com/?i=${movieID}&apikey=564727fa`
  );
  movieInfo.send();
}

Delete only div containers inside a container

The aim is to delete all div containers within a container and leave two anhchor tags untouched.

<div id="container">
  <div id="wrapper" class="slider">

    <div><img src=""></div>
    <div><img src=""></div>
    <div><img src=""></div>

    <!-- Next and previous buttons -->
    <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
    <a class="next" onclick="plusSlides(1)">&#10095;</a>

  </div>
</div>

expected / goal

<div id="container">
  <div id="wrapper" class="slider">
    <!-- Next and previous buttons -->
    <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
    <a class="next" onclick="plusSlides(1)">&#10095;</a>

  </div>
</div>

With innerHTML everything is deleted and therefore also the a tags. Is there an elegant and simple solution?

HTML input type=’range’ not moving

I have an Options component containing a slider input.
I don’t understand why the thumb of the slider doesn’t move if I set the “value” parameter, but i need it.

Here the code:

interface Props {
    value?: number
}

const Options: React.FC<Props> = ({ value }) => {

    return (
        <div className='options'>
            <span className='boh'>CUSTOMIZE YOUR PASSWORD</span>
            <div className='slider-container'>
                <input type="range" id="slider" min="1" max="100" value={value} />
                <label htmlFor="slider">Length</label>
            </div>
        </div>
    )
}

export default Options

I thank anyone who gives me a hand

Splitting sheet text using an array to mantain unique ID

I’m using this: How to transpose and split in Google Apps Script?

Which works great in the first part (I use it to copy data an split it) but then I would need to redo it since I have 2 different separators, first time “;” second time “,”.

The issue and I’m guessing it’s more JS related than anything else, is that if I use the same for it splits the 2nd column vertically. I’ll post examples.

Column A has the ID, Column B has the comma separated text

If I use it again to reformat it gives this:

enter image description here

I would like it to be split into Column B and C.

I figured it was because the for loop only pushes 2 rows, but I can’t solve adding a third.

Passing an object to a component as prop

I’m very green at react, and I’m trying to learn the library by messing around a bit.

I’m having problems passing an object to another component.
Ive created an array of objects that holds 2 string variables, 1 function and 1 int.

I’m trying to populate this inside a Grid container(Material UI framework).

When I pass the object to the other react component, it arrives as undefined. Ive tried to check if I’m passing a valid object by logging it to the console first, and it is valid.

I’ve also tried to refer to the properties in the component that receives the object, but the browser console throws Uncaught TypeError: Cannot read properties of undefined (reading 'person').

Does anyone know why it is being sent as undefined?

PersonList.js:

const personListe = [
    {
        firstName:'testFirstname',
        lastName:'testLastName',
        getFullName:function()
        {
            return `${this.firstName} ${this.lastName}`
        },
        age:28
    }
]

export default function PersonList() {
    
  return (
      <>
        <Grid container spacing={3}>
            {personListe.map((person) => {
                 return(
                    <Grid item xs={3} key={person.firstName}>
                    <PersonCard person={person} />   
                    </Grid>
                )
            })}
        </Grid>
    </>
  );
}

PersonCard.js:

export default function PersonCard({props})
{
    return (<>
        {console.log(props)}
    </>)
}

One submit button works on my form the other one refreshes the website while updating the url

Im trying to make a quiz using forms and the top submit button works perfectly while the bottom button does not work it ends up refreshing the page and it says the field selected in the address bar this is for a project for college and im a beginner to JavaScript if someone could help me out and explain how it works that would be great I understand how the script works with one from and one button and what the code does but im confused when it comes to 2 forms

var form = document.querySelector("form");
var log = document.querySelector("#log");
var points = 0;
var q1QuizAns = 0;
var q2QuizAns = 0;

form.addEventListener("submit", function(event) {
  var data = new FormData(form);
  var output = "";
  for (const entry of data) {
    output = output + entry[0] + "=" + entry[1] + "r";
    q1QuizAns = entry[1];
    q2QuzAns = entry[1];
  };
  log.innerText = output;
  event.preventDefault();
  pointsAdd();
}, false);

function pointsAdd() {
  if (q1QuizAns == 1) {
    points = points + 1;
    logPoints.innerText = points;
  } else if (q2QuizAns == 1) {
    points = points + 1;
    logPoints.innerText = points;
  }
}
<header>
  <ul class="navbar">
    <li><a href="Home.html">Home</a></li>
    <li><a href="Poland.html" class="active">Poland</a></li>
    <li><a href="Russia.html">Russia</a></li>
    <li><a href="Uzbekistan.html">Uzbekistan</a></li>
  </ul>
</header>

<div class="testBody">
  <div class="bodyText">
    <h1>Poland Test</h1>

    <form>
      <p>Please select your preferred contact method:</p>
      <div>
        <input type="radio" id="contactChoice1" name="question1" value="1">
        <label for="contactChoice1">Warsaw</label>
        <input type="radio" id="contactChoice2" name="question1" value="2">
        <label for="contactChoice2">Krakow</label>
        <input type="radio" id="contactChoice3" name="question1" value="3">
        <label for="contactChoice3">Straszyn</label>
      </div>
      <div>
        <button type="submit">Submit</button>
      </div>
    </form>
    <!-------------------------------------------------------------------------->
    <form>
      <p>What is the national animal of Poland</p>
      <div>
        <input type="radio" id="Question2Choice1" name="question2" value="1">
        <label for="Question2Choice1">White-Tailed Eagle</label>
        <input type="radio" id="Question2Choice2" name="question2" value="2">
        <label for="Question2Choice1">Black-Tailed Eagle</label>
      </div>
      <div>
        <button type="submit">Submit</button>
      </div>
    </form>
    <!-------------------------------------------------------------------------->
    <pre id="log">
        </pre>
    <pre id="logPoints"></pre>
    <!-------------------------------------------------------------------------->

  </div>
</div>

How to add Markes to a Leaflet-map with coordinates from Supabase database?

i want to add some Markers from coordinates stored in a supabase database colomn.
Here is my vue code:

<l-marker v-for="(marker, index) in markers" :key="index" ref="markersRef" :lat-lng="marker.position"></l-marker>

im script:

  export default {
   async created() {
    const { data: events, error } = await this.$supabase
     .from('events')
     .select('coordinates')
    this.markers = events
    this.loaded = true
    console.log(this.markers)
    
   },
  data: () => ({
   markers: [],
  }),
 }

if i output markes, the rusult is:

[ { “coordinates”: “lat: 59.339025, lng: 18.065818” }, { “coordinates”: “lat: 59.923043, lng: 10.752839” } ]

i hope you can help me. thanks.

Safari jquery select option .hide() alternative

I have a jquery script which at first hide all select options:

$('option[data-start="1"]').hide();

and then shows options based on user select of other input.

$('option[data-variable1="' + variable1x + '"][data-variable2="' + variable2x + '"]').show();

Everything works great, but on Safari .hide() doesn’t work.
I know about workaround:

$('option[data-start="1"]').prop('disabled', true);
$('option[data-variable1="' + variable1x + '"][data-variable2="' + variable2x + '"]').prop('disabled', false);

But this only turns off some options. I have dozens of options, so there is long list of inactive options.
I tried hiding inactive options, but Safari probably ignores this code:

select option[disabled="disabled"]{display:none !important;width:0;height:0;visibility: hidden;opacity:0;}
select option:disabled { display:none !important;height:0;width:0;visibility: hidden;opacity:0;}

Could you help me with some workaround for Safari?

Getting an error when trying to run my test in webdriverio

I have been having an issue when trying to run my webdriverio tests after trying to upgrade my node version. I am now getting the following error

2022-01-11T12:45:05.628Z DEBUG @wdio/config:utils: Couldn't find ts-node package, no TypeScript compiling
2022-01-11T12:45:05.729Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: /Users/eoincorr/Downloads/coding/DSI_UI_TESTS/wdioTest.conf.js: Cannot find module 'csv-stringify/sync'

Can someone please advise me on why this is happening and what to do?

Capture text inside multiple header tags with regex [duplicate]

Given a string with multiple html tags inside (headers and other), I’d like to extract all text inside multiple header tags.

A given string : '<h1>Header 1</h1> <p>blabla</p> <h2>Header 2</h2>'

Expected result : ['Header 1', 'Header 2']

I came up with this : /<h[1-9]>(.*)</h[1-9]>/g; but it works only for a single occurrence.