How to upgrade this react-router code to v6 of react router?

I upgraded to v6 of react router and now everything is off.

I have this that manages all routes basically but can not figure out how to make it work with v6:

export const Routes: React.FC<RouteProps> = ({ component: Component, ...rest }) => (
  <Route
    {...rest}
    render={(props) => (
      <Suspense fallback={<div>Loading...</div>}>
        <Layout>{Component && <Component {...props} />}</Layout>
      </Suspense>
    )}
  />
);

Query for a user and then a specific object in an array with one mongoose query

enter image description here

I have a user object as shown above. I am trying to write a mongoose query that finds the user via the req.user.id and then queries their wishList array for a specific item with the id that matches the req.params.id

Here is my query:

let userWishListItem = await User.find({_id: req.user.id, 'wishList': {_id: req.params.id}})

userWishListItem just gives back the user currently. how can I get back the specific wishList object in their wishList array. Any advice would be great.

Multiple html pages in react-router-dom

I have the following BrowserRouter in my main index.js React file:

<React.StrictMode>
<BrowserRouter> 
    <Routes>
        <Route path="/" element={<Main />}>
            <Route path="clients" element={<ClientsList />} > 
                <Route path="client/:clientID" element={<Client />} />
            </Route> 
            <Route path="*" element={<NoContent />} />
        </Route> 

        <Route path="iframe-invoice/:invoiceID" element={<InvoiceFrame />} />
        
    </Routes> 
</BrowserRouter>
</React.StrictMode>

When I load the paths /, clients and client/<clientID> the app correctly display the content of the relative modules in the /app/public/index.html file (as expected):

What I’m trying to do is to render the content of iframe-invoice/:invoiceID in a separate html page, something like /app/public/iframeinvoice.html.

The full HTML content of the module InvoiceFrame will be loaded from a database (both html head, body, styles, etc..) and it require to be rendered outside of the /app/public/index.html file.

Either in an apposite html file with only this:

<noscript>You need to enable JavaScript to tead the invoice</noscript>
<div id="root"></div>
<script type="text/javascript" src="/static/js/bundle.js"></script>

or in some other way.

So basically the React app on iframe-invoice/:invoiceID will have to:

  • Request the full HTML page of :invoiceID, with an API call, from the backend
  • Cache this HTML in the browser localstorage
  • Render this HTML in the browser (probably with dangerouslySetInnerHTML)
  • Next time the same invoice is requested load it from the localstorage and render it

Is it possible with React?

How to push data to firestore document?

i am solving this for few hours and i am lost.

basically what i want is that if document doesnt exist then create new one (it works fine now) but if document exist, just push new object to array.

I somehow was able to get data from document and console.log them but dont know how to push new one to document.

Any ideas? Thank you!

My FB structure look like this:

favorites
  someUserID
    Videos [ 

      0: {
      name: SomeName
      url: SomeUrl
      },

      /* I would like to push new objects like this: */

      1: {
      name: data.name
      url: data.url
      },
    ]

This is my current code:

 const { user } = UserAuth();
 const UserID = user.uid
 const favoritesRef = doc(db, "favorites", UserID)

const test = async (data) => {
    try {
        await runTransaction(db, async (transaction) => {
          const sfDoc = await transaction.get(favoritesRef);

          if (!sfDoc.exists()) {
            setDoc(favoritesRef, {
                Videos: [{name: data.name}]    
                })
          }

          /* I got my document content here */

         const newFavorites = await getDoc(favoritesRef)
         console.log("Document data:", newFavorites.data());
         
          /* And would like to push new Data here */
          transaction.update(favoritesRef, { name: data.name});
        });
        console.log("Transaction successfully committed!");
      } catch (e) {
        console.log("Transaction failed: ", e);
      }
    }

Default routing on Angular 8 doesn’t work fine

I have built an app on Angular 8 and the below is the routing configuration i have setup,

const routes: Routes = [
  { path: '',
  redirectTo: "/pages",
  pathMatch: 'full',
  },
  {
    path: 'pages',
    canActivate: [AuthGuard],
    loadChildren: () => import('./pages/pages.module')
      .then(m => m.PagesModule),
  },
  {
    path: 'auth',
    loadChildren: './auth/auth.module#NgxAuthModule',
  },
  { path: '**', redirectTo: 'pages' },
]; 

For some reason, the default routing doesn’t seem to work fine. I tried setting up the configuration to debug the routing and it looks like the router doesn’t seem to pick up the redirect at all. Can anyone let me know if i am doing something wrong. I tried all different values for redirectTo like ‘pages’. But nothing seems to work.

Can’t save data from Html Asp.net Core to Mysql Using

I am learning frontend and I face this problem to save data from Html to Mysql in Asp.Net Core:
I have Order Model
OrderDetails Model
and I made ViewModel
Html table coded to add Rows dinamicly
And i get project , supplier and Item by viewdata as select items

All above it was done But can not save the record!!


    <link rel="stylesheet" href="~/css/jquery.dataTables.min.css">
   <link rel="stylesheet" href="~/lib/font-awesome/css/all.min.css">
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="~/css/style.css">

  <!-- container -->
  <div class="container" >
 <div style="align-items:self-end">
  <input type="button" onclick="enabled()" value=" New Purchace Order" style="margin:10px 10px;" id="newOrder" class="btn  btn-info" />

                </div>
      @*      <div class="row bg-info m-1 block">
                <div class="text-center col-md-8">
                    <h1> Purchace Order <span id="countpro"></span></h1>
                    </div>
                    
            </div>*@


      <!-- Order Section -->   
            @*<form asp-action="Create">*@
                <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="row bg-secondary m-1 block">
            <div class="col-md-4 col-sm-12">
                <div class="form-group">
                    <label asp-for="OrderNO" class="control-label"></label>
                    <input asp-for="OrderNO" id="poNO" class="form-control" />
                    <span asp-validation-for="OrderNO" class="text-danger"></span>
                </div></div>

               <div class="col-md-4 col-sm-12">
                <div class="form-group">
                    <label asp-for="OrderDate" class="control-label"></label>
                    <input asp-for="OrderDate" id="poDate" class="form-control" />
                    <span asp-validation-for="OrderDate" class="text-danger"></span>
                </div></div>
                 <div class="col-md-4 col-sm-12">
                  <div class="form-group">
                    <label asp-for="Status" class="control-label"></label>
                    <input asp-for="Status" id="status" class="form-control" />
                    <span asp-validation-for="Status" class="text-danger"></span>
                </div></div>
              <div class="col-md-6 col-sm-12">
                <div class="form-group">
                    <label asp-for="ProjectId" class="control-label"></label>
                    <select asp-for="ProjectId" id="project"  class ="form-control" asp-items="ViewBag.ProjectId"></select>
                </div></div>
                 <div class="col-md-6 col-sm-12">
                <div class="form-group">
                    <label asp-for="SupplierId" class="control-label"></label>
                    <select asp-for="SupplierId" id="supplier"  class ="form-control" asp-items="ViewBag.SupplierId"></select>
                </div></div>
                <div class="form-group">
                    <label asp-for="Subject" class="control-label"></label>
                    <input asp-for="Subject" id="subject"  placeholder="Enter Order Description ...." class="form-control" />
                    <span asp-validation-for="Subject" class="text-danger"></span>
                </div>
         
     </div> 

      <!-- End Order Section -->

  
        <!-- Item Section -->
            <div class="row bg-primary m-1 block">
                 <div class="col-md-5 col-sm-12">
                   <div class="form-group">
                    <label asp-for="ItemId" class="control-label"></label>
                    <select asp-for="ItemId" id="item" asp-placeholder="Select Item ...." class ="form-control" asp-items="ViewBag.ItemId"></select>
                </div></div>
                 <div class="col-md-1 col-sm-12">
                   <div class="form-group">
                    <label asp-for="UnitId" class="control-label"></label>
                    <select asp-for="UnitId" id="unit" class ="form-control" asp-items="ViewBag.UnitId"></select>
                </div></div>
                <div class="col-md-1 col-sm-12">
                <div class="form-group">
                    <label asp-for="Qty" class="control-label"></label>
                    <input asp-for="Qty" id="qty"  class="form-control" onkeyup="getTotal()" onchange="getTotal()"/>
                    <span asp-validation-for="Qty" class="text-danger"></span>
                </div></div>
                <div class="col-md-1 col-sm-12">
                <div class="form-group">
                    <label asp-for="Price"  class="control-label"></label>
                    <input asp-for="Price" id="price" class="form-control" onkeyup="getTotal()" onchange="getTotal()" />
                    <span asp-validation-for="Price" class="text-danger"></span>
                </div> </div>
                <div class="col-md-2 col-sm-12">
                <div class="form-group">
                    <label asp-for="Total" class="control-label"></label>
                    <input asp-for="Total" id="total" class="form-control bg-danger text-center" disabled value="0" />
                    <span asp-validation-for="Total" class="text-danger"></span>

                </div></div>
                <div class="col-md-2 col-sm-12">
                  <label class="control-label">Add</label>
                    <button class="btn btn-success " onclick=" addRow();"  id="addButton">
                        <i class="fas fa-plus"></i></button>
                    

                </div>

            </div>
     <!-- End Item Section -->
  
         <!-- Table -->
       
                <table class="table " style="width:100%;" id="tablPro">
                    <thead>
                            <tr>
                             <th>#</th>
                                <th style="width:30%;">Product/Service</th>
                                <th style="width:10%;">Unit</th>
                                <th style="width:10%;">Qty</th>
                                <th style="width:10%;">Price</th>
                                <th style="width:15%;">Total</th>
                              <th style="width:5%;"></th>
                            <th style="width:5%;"></th>
                            </tr>
                        </thead>
                        <tbody id="tablePro">
                  <tr>
                     
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                    <td></td>
                      <td></td>  
                       </tr>

                        </tbody>
                    </table>
    

            <!-- End Table -->
                  <!--  Total Section  -->

            @* <div class="row bg-teal m-1 block" id="divPrint">*@
                <div class="totalcontainer">
                     <div class="col-md-3 col-sm-12">
                      <label asp-for="SubTotal" style="color:Black;"   class="control-label"></label>
                    <input asp-for="SubTotal"  id="subTotal"  class="form-control" />
                    <span asp-validation-for="SubTotal" class="text-danger"></span>
                    </div>
                    <div class="col-md-3 col-sm-12">
                    <label asp-for="Vat" style="color:Black;"  class="control-label"></label>
                    <input asp-for="Vat" id="vat" class="form-control" />
                    <span asp-validation-for="Vat" class="text-danger"></span>
                       </div>
                   <div class="col-md-3 col-sm-12">
                     <label asp-for="GrandTotal" style="color:Black;"   class="control-label"></label>
                    <input asp-for="GrandTotal" id="grandTotal" class="form-control" />
                    <span asp-validation-for="GrandTotal" class="text-danger"></span>
                </div>
                   <div class="text-center">
                   <input type="submit" value=" + Save Purchace Order" id="saveBtn" style="margin:10px 10px;" class="btn btn-primary" />
                        </div>                  

              
                </div>
    
                  <!-- End Total Section  -->
                  <hr />
                  <!-- End Createor Section  -->
               <div class="row block">
                 <div class="col-md-3 col-sm-12">
                <div class="form-group">
                    <label asp-for="CreatedBy" style="color:Black;" class="control-label"></label>
                    <input asp-for="CreatedBy" class="form-control" />
                    <span asp-validation-for="CreatedBy" class="text-danger"></span>
                </div>  </div> 
              <div class="col-md-3 col-sm-12">
                <div class="form-group">
                    <label asp-for="TimeStamp" style="color:Black;"  class="control-label"></label>
                    <input asp-for="TimeStamp" class="form-control" />
                    <span asp-validation-for="TimeStamp" class="text-danger"></span>
                </div>  </div> 
    </div>
                  <!-- End Createor Section -->



     
           @* </form>*@
</div>



      


@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script src="~/js/addRow.js"></script>


 <script src="~/lib/jquery/dist/jquery.js"></script>
 <script src="~/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
     <script src="~/lib/font-awesome/js/all.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
    <script>
           // $('#saveBtn').click(function() {
    //    var data = $('input').serialize();

    //    $.post(url, data, function(data) {
    //       console.log(data);
    //    }); 
    //});
     $(function () {
            $("#saveBtn").click(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json;charset=utf-8",
                    url: "CreatePos/Create",
                    data: "{'poNo':'" + $("#poNO").val() +
                    "', 'poDate':'" + $("#poDate").val() +
                    "', 'status':'" + $("#status").val() +
                    "', 'project':'" + $("#project").val() +
                    "', 'supplier':'" + $("#supplier").val() +
                    "', 'Subject':'" + $("#Subject").val() +
                    "', 'item':'" + $("#item").val() +
                    "', 'unit':'" + $("#unit").val() +
                    "', 'qty':'" + $("#qty").val() +
                     "', 'total':'" + $("#total").val() +
                    "', 'subTotal':'" + $("#subTotal").val() +
                    "', 'vat':'" + $("#vat").val() +
                     "', 'grandTotal':'" + $("#grandTotal").val() +  "'}",
                    async: false,
                    success: function (response) {
                
                         $("#poNO").val("");
                     $("#poDate").val("");
                   $("#status").val("");
                   $("#project").val("");
                  $("#supplier").val("");
                 $("#Subject").val("");
                   $("#item").val("");
                   $("#unit").val("");
                    $("#qty").val("");
                     $("#total").val("");
                    $("#subTotal").val("");
                     $("#vat").val("");
                      $("#grandTotal").val()

                        alert("record has been saved in database");
                    },
                    error: function () {
                        console.log("there is some error");
                    }
                });
            });
        });
</script>
}

And her is the Script File

    var value = document.getElementById('item');
    var getItem = value.options[value.selectedIndex].text;
    var unitValue = document.getElementById('unit');
    var getUnit = unitValue.options[unitValue.selectedIndex].text;
    var qty = document.getElementById('qty').value;
    var price = document.getElementById('price').value;
    var total = document.getElementById('total').value;
    var table = document.getElementsByTagName('table')[0];
    var newRow = table.insertRow(table.rows.length);
    var x = newRow.rowIndex - 1;
       var editBtn =`<button class="btn btn-info" id="editRow">
        <i class="fas fa-edit"></i>
    </button>` ;
    var deleteBtn =`<button class="btn btn-danger" onclick="deleteRow(this)">
        <i class="fas fa-trash"></i>
    </button>` ;
    //defination of row cells
    var cell1 = newRow.insertCell(0);
    var cell2 = newRow.insertCell(1);
    var cell3 = newRow.insertCell(2);
    var cell4 = newRow.insertCell(3);
    var cell5 = newRow.insertCell(4);
    var cell6 = newRow.insertCell(5);
    var cell7 = newRow.insertCell(6);
    var cell8 = newRow.insertCell(7);
    // Push row Values into tabel Body
      cell1.innerHTML = x++;
    cell2.innerHTML = getItem;
    cell3.innerHTML = getUnit;
    cell4.innerHTML = qty;
    cell5.innerHTML = price;
    cell6.innerHTML = total;
    cell7.innerHTML = editBtn;
    cell8.innerHTML = deleteBtn;
}
function getTotal() {
    if (price.value != '') {
        let result = price.value * qty.value;
        total.value = result;
        total.style.background = '#040';
        let vatPercentage = 0.15;
        let subtotal = document.getElementById('subTotal');
        let vat = document.getElementById('vat');
        let grandTotal = document.getElementById('grandTotal');     
        subtotal.value = total.value;
        vat.value = subtotal.value * vatPercentage;
        grandTotal.value = +vat.value + +subtotal.value;
    }
    else {
        total.value = '';
        total.style.background = '#a00d02';
    }
}

Finally This is the controller

     POST: CreatePos/Create
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Create([Bind("OrderId,OrderNO,OrderDate,Subject,Status,CreatedBy,TimeStamp,ProjectId,SupplierId,ItemId,UnitId,Qty,Price,Total,SubTotal,Vat,GrandTotal")] CreatePoModel createPoModel)
    {
        if (ModelState.IsValid)
        {
            _context.Add(createPoModel);
            await _context.SaveChangesAsync();
            return RedirectToAction(nameof(Index));
        }
        ViewData["ProjectId"] = new SelectList(_context.Projects, "ProjectId", "ProjectName", createPoModel.ProjectId);
        ViewData["SupplierId"] = new SelectList(_context.Suppliers, "SupplierId", "SupplierName", createPoModel.SupplierId);
        ViewData["ItemId"] = new SelectList(_context.PoItems, "ItemId", "ItemName", createPoModel.ItemId);
        ViewData["UnitId"] = new SelectList(_context.Units, "UnitId", "UnitCode", createPoModel.UnitId);
        return View(createPoModel);
    }

Please Consider that I am beginner still learning: (

Load Link by loop from googlesheet

I am working on chrome Extension and use JavaScript and Html..

Now iam face a problem in extension popup html page.

I have a Google sheet

https://docs.google.com/spreadsheets/d/1F43R_ZpA8619QS59jgYEEs-k4-dW4GmxtQfiMZw4nZc/edit?usp=drivesdk

which Have 3 Colomn
I want to use this cololm Data in This Link with loop.

For Example
https://www.truepeoplesearch.com/resultaddress?streetaddress=A1&citystatezip=B1%2C%20C1&page=1

After load this page
require click on button to reload All Code

But Now Action with next Row 2(A2,B2,C2)

This continued till the last line

Please Tell me complete Solution.

Console log in Reduce() returning NaN

This function sums the lengths of all array elements and it works by returning the final value, but using console.log returns the length of the first element and NaN for the rest. Why?

function test(s) {
  return s.split(' ').reduce((a, b) => {
      console.log(a + b.length)
    }, 0);
}

console.log(test("aa aaa aaaa"));

Cannot figure out multiple filters combined with search

so I’ve been staring at this thread for the past few days

javascript filter array multiple conditions

And while it offers fantastic solutions if know the filter params, what happens when I don’t know them both? I have no clue how to do that.

I have a very basic filter setup going…

// check for text search values to populate names 
    this.searchBar.addEventListener("keyup", e => {
      this.searchString = e.target.value.toLowerCase();
      this.new_table();
    });

// check for gender options 
    this.genderFilter.addEventListener("change", e => {
      this.genderOption = e.target.value;
      this.new_table();
    });

// Build out the filter
  new_table() {
    const searchText = this.searchString;

    let combinedFilter = this.response.filter(char => {
      const name = char.first_name.includes(searchText) || char.last_name.includes(searchText);
      const gender = this.genderOption;

      return name || char.gender == this.genderOption;
    });

    this.build_table(combinedFilter);
  }

// build_table is my function that takes the json data and converts it into html

This works fantastic for the OR situation, but if I change the return to &&, it requires both to be filled out to show any results.

I’m pretty new with JS but I am thinking a few ways to do it and I’m probably wrong on all.

  1. Build out the search params and store them into an object (ie {firstname: name, gender: gender}) and then this way I can just leave blank if empty.
    I don’t know how to actually return that, however. I tried a few different ways and I’m not even sure if that is possible.
  2. Figure out a default value for each which likely works well with the dropdowns (gender) as I can do if (both) then male || female type of line but the search part will have an issue if blank.

I’ve searched this board and the web but I apparently suck at searching because I couldn’t find anyone having a combined search+dropdown filter combo. It seems one or the other but never both.

Any help you can give would be amazing thank you!

Can’t see my auth state on redux dev tools

I am following a MERN tutorial (studying it at the same time) and after creating auth slice for the app, I can’t see my state in Redux dev tools. It shows null(pin):undefined

I’m pretty sure I haven’t made a typo. This is what I should be getting

Here’s my auth code if it’s any help:


// Get user from localStorage

const user = JSON.parse(localStorage.getItem('user'))

const initialState = {
  user: user ? user : null,
  isError: false,
  isSuccess: false,
  isLoading: false,
  message: "",
};

export const authSlice = createSlice({
    name:"auth",
    initialState,
    reducers: {
        reset:(state) => {
            state.isLoading = false
            state.isError = false
            state.isSuccess = false
            state.message = ''
        }    
    },
    extraReducers: () => {}
})

export const {reset} = authSlice.actions
export default authSlice.reducer

I import this in the store.js file which is rendered in index.js

Spring and Angular: How to make two http calls one after another with a condition

I have an Angular interface which handles a file upload, after a submit button it persist this file in MySQL database. I want to make another call inside this submit method but the second http call needs the id of that entity persisted(file) and I don’t know how to retrieve that specific id from that file uploaded.

this is my submit method:

onSubmit() {

        const statementFile = new StatementFile();

// *******
// here are some business logic
// *******


// this will send POST request and save it to MySQL.
        this.statementFileService.postStatementFile(statementFile).subscribe(
            {
                next : (response) => {
                    alert('You have been submitted your statement file, check MySQL');
                },
                error: (err) => {
                    alert(`there was a problem: ${err.message}` );
                }
            }
        );


// this is the second http request I want to call but it needs particularly the id of that statementFile uploaded.
this.activitiWorkflowService.createPreccess(statementFile.statementFileId).pipe(takeUntil(this._unsubscribeAll), debounceTime(3000)).subscribe(
            (data: any) => data
        );

    }

this is my StatementFile class:

export class StatementFile{

    statementFileId: number;
    dateReception: Date;
    label: string;
}

Refresh resets the instructed javascript css properties

I have a button to change my background of my html site. But I need to remember which background I had last. Anyone know where to look for this problem?

`

<button id="noAnimation" onclick="changeBackground()">Stop Animation</button>
<button id="Animation" onclick="displayAnimation()">Start Animation</button>

function changeBackground(){
  document.getElementById('videoplayer').style.display = "none";
  document.getElementById('noAnimation').style.display = "none";
  document.getElementById('Animation').style.display = "block";
}
function displayAnimation (){
    document.getElementById('videoplayer').style.display = "block";
    document.getElementById('noAnimation').style.display = "block";
    document.getElementById('Animation').style.display = "none";
}

`

How to target the selector on new tab after clicking a[target=”_blank”] – Failing to activate the new tab created

After clicking a[target=”_blank”] new tab opens. How to get code to get new page object so I can access password input field?
Using NodeJS, JavaScript, Puppeteer.

Navigation is working up to the point included below.

I tried adjusting the script and received following errors
Cannot read properties of undefined (reading 'page') – I thought adding a time delay would solve this but no go.

I was having this error but as the code is below I do not get this error: No node found for selector: #Password

I have looked at related issues
I came across dheerajbhaskar GitHub issue and read up on related issues

  • #386
  • #3535
  • #978
    and more

I tried to implement code from an accepted answer without any success.
Using Puppeteer to get a handle to the new page after “_blank” click?

try {
      await sleep(2300)
// This block creates a new tab 
// I was previously using a selector and not mouse click API 
      await Promise.all([
        page.mouse.click(xToolsBtn, yToolsBtn, { delay: 2000 }),
      ])
      // NEW TARGET CREATED
      // Below is a snippet from an accepted answer but the the type method 
      // does not work
      // Seems like page is still not activated
      const [newTarget] = await Promise.all([
        // Await new target to be created with the proper opener
        new Promise((x) =>
          browser.on("targetcreated", (target) => {
            if (target.opener() !== page.target()) return
            browser.removeListener("targetcreated", arguments.callee)
            x()
          })
        ),
        // page.click('link')
      ])
      // Trying to input password without success
      const newPage = await newTarget.newPage()
      await newPage.type("#Password", process.env.PASSWORD, {
        delay: randomGenerator,
      })
    } catch (err) {
      console.error(
        "LOGIN BUTTON FAIL",
        err.message
      )
    }

Alternatively atempt#1: I tried to select the input via mouse x, y co-ordinates which activates the input field but this returns the following error”
No node found for selector: #Password

Alternatively atempt#2:

//* WAIT FOR TARGET
    try {
      await sleep(2300)
      await Promise.all([
        page.mouse.click(xToolsBtn, yToolsBtn, { delay: 2000 }),
      ])
      sleep(5000)
      await page.evaluate(() => window.open(`${loginUrl3}`))
      const newWindowTarget = await browser.waitForTarget(
        (target) => target.url() === `${loginUrl3}`
      )
      console.log("GOT TARGET")
      await newWindowTarget.type("#Password", process.env.PASSWORD, {
        delay: randomGenerator,
      })
    } catch (err) {
      console.log("WAIT FOR TARGET FAILED")
    }

Note: URLS are randomly generated so I would be curious what if any work around there is to use current URL. I would assume the new tab created would still need to be activated…