I want to make a connection between Excel, ChatGPT and UIPath

Situation description:

I’m working on a project in UiPath where I want to inject JavaScript into a web page to retrieve specific information. The workflow uses the Inject JS Script activity, where the goal is to retrieve the text of the last element in a list (with a specific CSS class) and store it in a UiPath variable called description.

Problem:
When executing my JavaScript code I keep getting a SyntaxError. Initially I got the error message Unexpected token 'const', after which I tried to replace const with var. However, this resulted in a new error message: Unexpected token 'var'. It appears that the JavaScript code I am trying to execute is not being interpreted correctly by the UiPath environment. This suggests that there is a limitation in how the JavaScript code is handled by UiPath, possibly due to the version of the browser I am using or the syntax I am using.

What I tried:

  1. Changing from const to var: This led to a new error message.
  2. Minimize the code: I tried simplifying the code to see where the problem lies, but the error still occurs.
  3. Function structure check: I made sure the JavaScript code was properly embedded in a function, but that didn’t solve the problem.
  4. Using older JavaScript syntax: Despite avoiding modern JavaScript syntax, I continue to receive the same error.

Thanks in advance for the help!

Hello @julie1!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff