GET http://localhost:4201/remoteEntry.mjs net::ERR_EMPTY_RESPONSE NX micro front-end

Using NX microfront to serve the multiple application over HTTPS, getting an exception as

GET http://localhost:4201/remoteEntry.mjs net::ERR_EMPTY_RESPONSE

In package.json

"serve": {
  "executor": "@nx/angular:webpack-dev-server",
  "configurations": {
    "production": {
      "browserTarget": "product:build:production"
    },
    "development": {
      "browserTarget": "product:build:development"
    }
  },
  "defaultConfiguration": "development",
  "options": {
    "port": 4201,
    "publicHost": "https://localhost:4201",
    "ssl": true,
    "sslKey": "././certificate/localhost.key",
    "sslCert": "././certificate/localhost.crt"
  }
},

In the development I am serving the application in HTTPS, how in the browser console

enter image description here

Removing the HTTPS works fine. Using the latest NX version 16.0.0

How do i change the className using onClick = {() => setState(“id”)} useEffect only work after the button is pressed witch is too late

Ive tried using setState but it only registers after the className has been changed

const [open, setOpen] = useState(“”)

useEffect(() => {
    setOpen(open);
},[open]);

function ActiveClass(buttonClicked){

    let button = document.getElementById(buttonClicked)

    if(open != buttonClicked)
    {
        button.className = classes.dropdownbtnopen
    }
    else if(open == buttonClicked)
    {
        button.className = classes.dropdownbtn
    }


}

return <div id="container" className={classes.sidebar}>
    <button id="startsida-fjärrvärmenät" className={classes.dropdownbtn} onClick={ () => {setOpen("startsida-fjärrvärmenät"); ActiveClass("startsida-fjärrvärmenät")}}>Startsida: Fjärrvärmenät</button>
    <button id="startsida-användare" className={classes.dropdownbtn} onClick={ () => {setOpen("startsida-användare"); ActiveClass("startsida-användare")}}>Startsida: Isak</button>

Thermal Printing on 3-inch POS printer using React-Native

I am facing trouble with print layout and design settings of a receipt using my React Native Code. I have explored printing HTML, converting HTML to PDF and printing the receipt, and printing a png image, as well as what I have been currently exploring, which is ESC/POS commands. I seem to have gotten to the layout design I require, but I am facing issues with the dynamic changes to the item list in each receipt.

Here is a sample of my ESC/POS commands with the item list hard-coded.

//#region INVOICE DESIGN
  const invoiceDesign =
    "[L]n" +
    "[L]" +
    "[C]<font size='big'><u>SALES REPORT</u></font>" +
    "[R]n" +
    "[L]n"+
    "[L]<font size='tall'>Customer :</font>n" +
    "[L]Raymond DUPONTn" +
    "[L]5 rue des girafesn" +
    "[L]31547 PERPETESn" +
    "[L]Tel : +33801201456n" +
    "[L]n" +
    "[L]n" +
    "[C]<u><font size='medium'>Item List</font></u>n" +
    "[L]n" +
    "[L]<b>BEAUTIFUL SHIRT</b>[R]t9.99en" +
    "[L]  + Size : Sn" +
    "[L]n" +
    "[L]<b>AWESOME HAT</b>[R]t24.99en" +
    "[L]  + Size : 57/58n" +
    "[L]n" +
    "[C]-------------------------------------------------n" +
    "[R]TOTAL PRICE :[R]t34.98en" +
    "[R]TAX :[R]t4.23en" +
    "[L]n" +
    "[C]<barcode type='ean13' height='10'>831254784551</barcode>n" +
    "[L]n" +
    "[C]<font size='small'>Generated on 15-06-2023 by QuickBill</font>n" +
    "[L]n" +
    "[L]n" +
    "[C]<font size='small'>End of report</font>n" +
    "[L]n";
  //#endregion

I would like to dynamically set the items.

Any help would be much appreciated.

Thanks in advance.

JEE: Register user logout when closing the application (i.e. all opened windows)

I need to register the time that a user logout from my JEE web application, either manually using logout button, or by closing all windows (browsers) opened by the user .

The loginlogout is managed using a CDI Session BEAN

this is what I tried till now:

1. Using of javascript “beforeUnloadEvent” where I call an ajax request (a servlet inside my application) to register user logout, but this event is fired on each tab/browser closed.. Which is not suitable in my case.
2. I also tried to perform the registration on “@Predestory” method in my bean, but the method is not called until the “session-timeout” defined in web.xml expires.. Whereas the user could have been logged out long time ago…
3. I created a web socket in the template.js and tried to benefit from its “onclose” event, but this also works on each tab closing…

I am out of ideas, hope you can help out…

How to remove a job from mongodb in agenda jobs? in nodejs

I am trying to create a Nodejs mongodb api that takes a job id from the body and then delete/cancel that job which is schedule with the help of agenda package in nodejs how can i do this thing? currently its not working its giving me a error that “No jobs found” but when i check my db there are jobs so how to delete that job? when i schedule the job it automaticity creates a agendaJobs collection in my mongodb database

router.delete('/canceljob', async (req, res) => {
    const { _id } = req.body;
    try {
      const jobs = await agenda.jobs({ _id });
      if (jobs.length === 0) {
        return res.json({ message: 'Job not found' });
      }
  
      await jobs[0].remove();
  
      return res.json({ message: 'Job canceled and deleted successfully' });
    } catch (err) {
      console.error(err.message);
      res.status(500).json('Server error');
    }
}); 

Cannot close the aler MUI with the icon close button

I have a snackbar and inside an alert. The issue is that I cannot close the alert by clicking on the close icon. I have a close function but it seems not working for me. How can I solve this?
This is what I have so far:

export const DevBar = (): ReactElement | null => {
  const env = useEnv();

  const [open, setOpen] = useState(false);

  const handleClick = () => {
    setOpen(true);
  };

  const handleClose = (_event?: Event | React.SyntheticEvent, reason?: string) => {
    if (reason === 'clickaway') {
      return;
    }
    setOpen(false);
  };

  return (
    <Root className={classes.devbar}>
      <EnvHopper />
      {env === 'dev' && (
        <>
          
      <Button onClick={handleClick}>
        info
        <Snackbar
          open={open}
          autoHideDuration={4000}
          anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
          onClose={handleClose}
        >
          <Alert
            sx={{
              width: '487px',
              height: '104px',
              paddingTop: '20px',
              paddingLeft: '20px',
              backgroundColor: '#FDFDFD',
            }}
            icon={false}
            onClose={handleClose}
          >
            <AlertTitle sx={{ paddingRight:'80px' }}>
              <Typography variant='headings.h4'>title</Typography>
            </AlertTitle>
            <Typography variant='captions.default'>Insert message here</Typography>
          </Alert>
        </Snackbar>

      </Button>
      

    </Root>
  );
};

Send PDF to given Email using javascript/vue on click of button

I have created a working site where I am asking users to enter their Email IDs and other personal details. After that, I am creating a PDF that contains all those user-entered details. Now on the last page when the process is completed, I am giving the user two buttons:

  1. Download PDF
  2. E-mail Details

enter image description here

I am using jsPDF to create this PDF.

Now PDF is getting downloaded on the user’s system when the “Download PDF” button is clicked, which is exactly what I want to happen.

MAIN PROBLEM :
I want the same PDF to be sent, attached to an E-mail to the user (on the same E-mail that the user has entered during the process) when the “E-mail Details” button is clicked by the user. This needs to be done using JavaScript/Vue. (I have no idea if it is possible)

I am working on Vue projects / Javascript projects. So any solution, be it Vue or JS, will work for me.

Is there any method to do it, please share it with me here on Stack Overflow. It would be a great help and would be highly appreciated.

Thanks for the Help !!

Redirect rule in Microsoft Edge does not work when trying to specify Bing as a starting point

When I try to specify the following rule in an extension, it works in the Chrome browser but does not work in the Microsoft Edge browser. I would like to know why this might happen? For some reason, if Bing is specified, then the redirect rule stops working. With other sources, everything is in order.

const rules = await chrome.declarativeNetRequest.getDynamicRules();

await chrome.declarativeNetRequest.updateDynamicRules({
  removeRuleIds: rules.map((r) => r.id),
  addRules: [
    {
      id: 1,
      priority: 1,
      action: {
        type: "redirect",
        redirect: {
          regexSubstitution: "https://www.google.com/search?q=\1",
        },
      },
      condition: {
        regexFilter: "^https:\/\/www.bing.com\/search\?q=([^&]*)",
        resourceTypes: ["main_frame", "sub_frame"],
      },
    },
  ],
});

I want to know why this is happening. Perhaps there is some reason?

can’t fetch one part of data from API (d3)

I want to make a bar chart that displays the data when using on(mouse over). I can get it to work but it doesn’t display the country name. Only “undefined”.
What did I do wrong and how can I make it work?

the data URL: [https://disease.sh/v3/covid-19/countries?sort=” + dataType]

current bar chart (screenshot)

JS:

function App() {

    const [countryData, setCountryData] = React.useState([]);
    const [dataType, setDataType] = React.useState("casesPerOneMillion")
    const [widthOfBar, setWidthOfBar] = React.useState(5)
    React.useEffect(() => {
       async function fetchData() {
                const response = await fetch("https://disease.sh/v3/covid-19/countries?sort=" + dataType)
                const data = await response.json();
                console.log(data)
                setCountryData(data);
            }  
            fetchData();
    }, [countryData])


    return (
        <div>
            <h1> Covid Stats </h1>
            <select name="datatype" id="datatype" 
            onChange={(e) => setDataType(e.target.value)}
            value={dataType}
            >
                <option value="casesPerOneMillion"> Cases Per One Million </option>
                <option value="cases"> Cases </option>
                <option value="deaths"> Deaths </option>
                <option value="tests"> Tests </option>
                <option value="deathsPerOneMillion"> Deaths Per One Million </option>
            </select>
            <label htmlFor="widthofbar" >
                  Width of bar
                <input 
                    name="widthofbar"
                    type="number"
                    value={widthOfBar}
                    onChange={(e) => setWidthOfBar(e.target.value)}
                    />
            </label>
            <div className="visHolder">
                {countryData.length > 0 && (
                    <BarChart 
                        data={countryData} 
                        height={500} 
                        widthOfBar={widthOfBar} 
                        width={countryData.length * widthOfBar} 
                        dataType={dataType}
                        />
                )}
            </div>
        </div>
     );
    }

function BarChart({ data, height, width, widthOfBar, dataType }) {
    React.useEffect(() => {
         createBarChart();
    }, [data, widthOfBar]);
        

    
      const createBarChart = () => {
        const countryData = data.map((country) => country[dataType]);
       
        const countries = data.map((country) => countryData.country);
        
       
        
  
        let tooltip = d3
            .selectAll("div")
            .select(".visHolder")
            .append("div")
            .attr("id", "tooltip")
            .style("opacity", 0);


        const dataMax = d3.max(countryData);
        const yScale = d3
          .scaleLinear()
          .domain([0, dataMax])
          .range([0, height]);
   
       
        d3.select("svg")
          .selectAll("rect")
          .data(countryData)
          .enter()
          .append("rect");
          
          
    var svg = 
        d3.select("svg")
          .selectAll("rect")
          
          .data(countryData)
          .style("fill", (d, i) =>(i % 2) == 0 ? "#9595ff" : "#44ff44")
          .attr("x", (d,i) => i * widthOfBar)
          .attr("y", (d) => height - yScale(d + dataMax * 0.1))
          .attr("height", (d,i) => yScale(d + dataMax * 0.1))
          .attr("width", widthOfBar)
          .on("mouseover", (event, d, i) => {
            tooltip
              .style("opacity", 0.9)
              .html(countries[i] + `<br/> ${dataType}: ` + d)
              .style("left", i * widthOfBar)
              .style("top", height - event.pageY );
          }) 
          // had version error d3.event isn't supported in new version, became event only
          
          
        };

  
    return <svg width={width} height={height}></svg>;
  }


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <link rel="stylesheet" href="styles.css">
    <title id="title"></title>
    <g id="x-axis"></g>
    <g id="y-axis"></g>

</head>
<body>
    <div id="root" ></div>
    <script src="./index.js" type="text/babel"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.2/d3.min.js"></script> 
    <script src="https://d3js.org/d3.v7.min.js"></script>

</body>
</html>

Should i use a global guard or different guards, the point is that i have a global guard and i need to exclude it for some request

i have implemented this guard which runs for every route but i need to exclude it for login or register.
how should i resolve this by best practice??

this are the routes:

 @SetMetadata('public', true)
  @Post('login')
  public async login(
    @Body('email') email: string,
    @Body('password') password: string,
  ): Promise<any> {

    return this.authService.loginUser(email, password);
  }


@SetMetadata('roles', ['admin'])
  @Get('allUser')
  public async getAll() {
    return await this.authService.getAllUsers();
  }

Guard example:

@Injectable()
export class AuthGuard implements CanActivate {
  constructor(private reflector: Reflector) {}

  canActivate(context: ExecutionContext): boolean {

    const isPublic = this.reflector.getAllAndOverride<boolean>("public",[context.getHandler(),context.getClass()]);
    const getHandler = this.reflector.get<string[]>('roles', context.getHandler());
    console.log('---roles--as---isPublic--', isPublic);
    console.log('---roles--from getHandler--', getHandler);

    if (isPublic) {
      return true
    }

    const request = context.switchToHttp().getRequest();
    const roles = request.user["roles"];

    console.log('---roles----', roles);

    if(roles === "guest" && typeof isPublic === "undefined"){
      return true
    } else{
      throw new UnauthorizedException()
    }
  }
}

filter an array of objects based on another array of objects

I have a list of subjects and need to filter it based on the filter selection

let subjects = [
    {
        "id": "course 1",
        "title": "course 1",
        "area": ["red"," blue"],
        "mode": "offline",
        "available": "full-time | part-time",
    },
    {
        "id": "course 2",
        "title": "course 3",
        "area": ["red"],
        "mode": "online",
        "available": "part-time",
    },
    {
        "id": "course 2",
        "title": "course 3",
        "area": ["blue", "green"],
        "mode": "offline",
        "available": "full-time | part-time",
    },
]

There are 3 filters(area, mode, available) where the user can select multiple options from each filter

For example, after user selection my filter object looks like (it can be empty if none of the options are chosen from filters, here I have not chosen any options from filter2)

let filters = { filter1: ["red", "green"], filter2: "" , filter3: ["full-time"]}

Expected output

Based on the filters selected, I need to display the subjects that has

  1. subjects.area as red or green or both
  2. subjects.available as full-time
let subjects = [
    {
        "id": "course 1",
        "title": "course 1",
        "area": ["red"," blue"],
        "mode": "offline",
        "available": "full-time | part-time",
    },
    {
        "id": "course 2",
        "title": "course 3",
        "area": ["blue", "green"],
        "mode": "offline",
        "available": "full-time | part-time",
    },
]

Things I tried

  1. I tried using filter() and includes
const results = subjects.filter(function(s){
                  return s.includes(filters)
               )};
  1. I tried converting the filter object to an array with the selected values eg;let filters = ["red","green","full-time"] and used filter() and includes , but no luck

How do I create a private route in react router dom version 6?

I am trying to create a private route. This private route will only be visible after logging in successfully. The user will be authenticated using javascript cookies and localstorage. I am using react router dom version 6.

/src/auth/Signin.js

import React, { useState } from 'react';
import { Link, Navigate } from 'react-router-dom';
import Layout from '../core/Layout';
import axios from 'axios';
import { authenticate, isAuth } from './Helpers';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.min.css';

const Signin = () => {
  const [values, setValues] = useState({
    email: '[email protected]',
    password: 'abcdefgh',
    buttonText: 'Submit'
  }); // values is an object while setValues is a function

  const { email, password, buttonText} = values; // destructure

  const handleChange = (name) => (event) => { // the name is the name of the field(name, email, password)
    // code snippet
  }; // a function returning a function

  const clickSubmit = event => {
    // code snippet
  };

  const signinForm = () => (
    // code snippet
  );

  return (
    <Layout>
      <div className="col-md-6 offset-md-3">
        <ToastContainer />
        {isAuth() ? <Navigate to="/" /> : null}
        <h1 className="p-5 text-center">Signin</h1>
        {signinForm()}
      </div>
    </Layout>
  );
};

export default Signin;

/src/auth/Helper.js

import cookie from 'js-cookie';

// code snippet

// access user info from localstorage
export const isAuth = () => {
  if (window !== 'undefined') {
    const cookieChecked = getCookie('token');

    if (cookieChecked) {
      if (localStorage.getItem('user')) {
        return JSON.parse(localStorage.getItem('user'));
      } else {
        return false;
      }
    }
  }
};

/src/auth/PrivateRoute.js

import React, { Component } from 'react';
import { Route, Navigate } from 'react-router-dom';
import { isAuth } from './Helpers';

const PrivateRoute = ({ component: Component, ...rest }) => (
    <Route
      {...rest}
        render={props =>
          isAuth() ? (
            <Component {...props} />
          ) : (
              <Navigate 
                to={{
                  pathname: '/signin',
                  state: { from: props.location }
              }} />
            )
        }
    ></Route>
);

export default PrivateRoute;

/src/core/Private.js — This is the private page

import React from 'react';
import Layout from './Layout';

const Private = () => (
  <Layout>
    <h1>Private page</h1>
  </Layout>
)

export default Private;

/src/core/Routes.js — Main routes file

import React from 'react';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import App from './App';
import Signup from './auth/Signup';
import Signin from './auth/Signin';
import Activate from './auth/Activate';
import Private from './core/Private';
import PrivateRoute from './auth/PrivateRoute';

const StartingRoutes = () => {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" exact element={<App />} />
        <Route path="/signup" exact element={<Signup />} />
        <Route path="/signin" exact element={<Signin />} />
        <Route path="/auth/activate/:token" exact element={<Activate />} />
        <PrivateRoute path="/private" element={<Private />} />
      </Routes>
    </BrowserRouter>
  );
};

export default StartingRoutes;

Problem: I am seeing a Uncaught Error: [PrivateRoute] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment> error on browser and terminal. Again I am using react router dom version 6.

[PrivateRoute] is not a component. All component children of
must be a or <React.Fragment>

I tried the following changes on Routes.js below but still it didn’t work

<Route exact path='/' element={<PrivateRoute/>}>
  <Route exact path='/' element={<Private/>}/>
</Route>

Any help is greatly appreciated. Thanks

How to avoid delta frames when going to previous frames using WebCodecs VideoDecoder?

I have created a custom video player using WebCodecs VideoDecoder and mp4box.js for mp4 parsing. I have also implemented frame-by-frame control, which works as expected. However, due to the limitation of VideoDecoder, when I go to previous frames, I must first process all of the frames since the last key frame until the target frame. As a result, all of these frames are rendered to the target canvas which doesn’t look very good.

How can I prevent rendering intermediate frames when going to a previous frame and only display the target frame?

Here’s my code:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Custom Video Player</title>
</head>

<body>
  <canvas id="videoCanvas" width="640" height="360"></canvas>
  <br>
  <input type="file" id="fileInput" accept="video/mp4">
  <button id="play">Play</button>
  <button id="pause">Pause</button>
  <button id="nextFrame">Next frame</button>
  <button id="prevFrame">Previous frame</button>

  <script src="mp4box.all.min.js"></script>
  <script>
    const fileInput = document.getElementById('fileInput');
    const playButton = document.getElementById('play');
    const pauseButton = document.getElementById('pause');
    const nextFrameButton = document.getElementById('nextFrame');
    const prevFrameButton = document.getElementById('prevFrame');
    const canvas = document.getElementById('videoCanvas');
    const ctx = canvas.getContext('2d');

    let mp4boxFile;
    let videoDecoder;
    let playing = false;
    let frameDuration = 1000 / 50; // 50 fps
    let currentFrame = 0;
    let frames = [];
    let shouldRenderFrame = true;


    function findPreviousKeyFrame(frameIndex) {
      for (let i = frameIndex - 1; i >= 0; i--) {
        if (frames[i].type === 'key') {
          return i;
        }
      }
      return -1;
    }

    async function displayFramesInRange(start, end) {
      shouldRenderFrame = false;
      for (let i = start; i < end; i++) {
        if (i == end - 1) {
          shouldRenderFrame = true;
          console.log("end");
        }
        await videoDecoder.decode(frames[i]);
      }
    }

    function shouldRenderNextFrame() {
      return shouldRenderFrame;
    }

    async function prevFrame() {
      if (playing || currentFrame <= 1) return;

      // Find the previous keyframe.
      const keyFrameIndex = findPreviousKeyFrame(currentFrame - 1);

      // If no keyframe found, we can't go back.
      if (keyFrameIndex === -1) return;

      // Display frames from the previous keyframe up to the desired frame.
      await displayFramesInRange(keyFrameIndex, currentFrame - 1);
      currentFrame--;
    }

    async function initVideoDecoder() {
      videoDecoder = new VideoDecoder({
        output: displayFrame,
        error: e => console.error(e),
      });
    }

    function displayFrame(frame) {
      if (shouldRenderNextFrame()) {
        ctx.drawImage(frame, 0, 0);
      }
      frame.close();
    }

    function playVideo() {
      if (playing) return;
      console.log('Playing video');
      playing = true;
      (async () => {
        for (let i = currentFrame; i < frames.length && playing; i++) {
          await videoDecoder.decode(frames[i]);
          currentFrame = i + 1;
          await new Promise(r => setTimeout(r, frameDuration));
        }
        playing = false;
      })();
    }

    function getDescription(trak) {
      for (const entry of trak.mdia.minf.stbl.stsd.entries) {
        if (entry.avcC || entry.hvcC) {
          const stream = new DataStream(undefined, 0, DataStream.BIG_ENDIAN);
          if (entry.avcC) {
            entry.avcC.write(stream);
          } else {
            entry.hvcC.write(stream);
          }
          return new Uint8Array(stream.buffer, 8);  // Remove the box header.
        }
      }
      throw "avcC or hvcC not found";
    }

    function pauseVideo() {
      playing = false;
    }

    function nextFrame() {
      if (playing || currentFrame >= frames.length) return;
      videoDecoder.decode(frames[currentFrame]);
      currentFrame++;
    }

    fileInput.addEventListener('change', () => {
      if (!fileInput.files[0]) return;
      const fileReader = new FileReader();
      fileReader.onload = e => {
        mp4boxFile = MP4Box.createFile();
        mp4boxFile.onReady = info => {
          const videoTrack = info.tracks.find(track => track.type === 'video');
          const trak = mp4boxFile.getTrackById(videoTrack.id);
          videoDecoder.configure({
            codec: videoTrack.codec,
            codedHeight: videoTrack.video.height,
            codedWidth: videoTrack.video.width,
            description: this.getDescription(trak)
          });
          mp4boxFile.setExtractionOptions(videoTrack.id);
          mp4boxFile.start()
          mp4boxFile.onSamples = (id, user, samples) => {
            frames.push(...samples.map(sample => new EncodedVideoChunk({
              type: sample.is_sync
                ? 'key' : 'delta',
              timestamp: sample.dts,
              data: sample.data.buffer,
            })));
          };
          mp4boxFile.flush();
        };
        e.target.result.fileStart = 0;
        mp4boxFile.appendBuffer(e.target.result);
      };
      fileReader.readAsArrayBuffer(fileInput.files[0]);
    });

    playButton.addEventListener('click', playVideo);
    pauseButton.addEventListener('click', pauseVideo);
    nextFrameButton.addEventListener('click', nextFrame);
    prevFrameButton.addEventListener('click', prevFrame);

    initVideoDecoder();

  </script>
</body>

</html>

I am not able to clear the text from textbox using java from jwtio.com website

I am using selenium framework in eclipse . I want to clear the text from encoded textbox using java function . tried by different ways with clear ,backspace and javascript still not getting expected result. How can i clear text , please suggest .

getting error on console:
Error ‘}, goog:chromeOptions: {debuggerAddress: localhost:61642}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: a189e4d9a52b8e84ebf04e4e864c55e1’ occured in step: ‘clear’. For reference, please refer line number: ‘29741’ in class ‘EDGE_Progression_Swarali’

tried by different ways with clear ,backspace and javascript still not getting expected result. How can i clear text , please suggest .

I am expecting to get text , clear it and enter another text into the same textbox