Selenium javascript troubleshooting: encountering problems with splitting strings

Hello, I am new to using selenium and encountering an issue with splitting a string.

<tr>
    <td>storeEval</td>
    <td>dList = '${StaffAdminEmail}'.split('@'); </td>
    <td>dsplit1 </td>
</tr>
<tr>
    <td>storeEval</td>
    <td>day = storedVars.dsplit1[1]</td>
    <td>dsplit2</td>
</tr>
<tr>
    <td>type</td>
    <td>id=school_permalink</td>
    <td>${dsplit2}</td>

Here,

${StaffAdminEmail} = <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="daa9bbb7aab6bf9aa9bbb7aab6bff4b9b5b7">[email protected]</a>

Upon execution, I encountered the error:

[error] Threw an exception: storedVars.dsplit1 is undefined

After searching on Google, I found a helpful link. However, I am unsure how to apply it in my scenario. Any suggestions?

Answer №1

One solution to the issue at hand is simply to eliminate the extra whitespace following dsplit1 in the initial command.

The adjustment should be made as follows:

<tr>
    <td>storeEval</td>
    <td>dList = '${StaffAdminEmail}'.split('@'); </td>
    <td>dsplit1</td>
</tr>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for sending PHP variables together with a Typeahead variable

I have simplified this code as much as possible. I have a typeahead variable that is functioning correctly. However, I also need to pass two unrelated variables $php_var1 and $php_var2 along with the typeahead variable. These PHP variables are initialized ...

Is it possible for the server to initiate communication with the client

Every time I try to find a solution, Comet always comes up. But it seems like overkill for what I need - just around 100 users at most, with maybe 10 online simultaneously. Is there a simpler and more suitable option for my needs, such as pushing data to ...

Only the initial element within the specified class is targeted by JQuery

Currently, I am utilizing Kendo UI to refresh multiple charts by class without having to access each one individually. Here is the code snippet I am using: $(".k-chart").data("kendoChart").refresh(); The issue I am encountering is that only the first cha ...

Plotly: maintaining consistent color scheme across identical elements in multiple graphs

I am currently utilizing Plotly in Javascript to generate some interactive graphs. My goal is to create 2 pie charts that display the distribution of a sale based on A) units and B) value. While I am able to generate the plots successfully, I have notice ...

What is the best way to modify the size of a canvas element while maintaining effectiveness?

I've encountered an issue while using Canvas to create a pie chart with chart.js. Despite adjusting the dimensions of the canvas element, it continues to take up the entire page. <canvas id="myChart" height ="200" width="200"></can ...

How can I select the latest message in a chat using selenium in Python?

I am utilizing the python selenium library to automate tasks. My goal is to programmatically click on the last message that appears in a chat window. Here is the website I am working with: # -*- coding: utf-8 -*- from selenium import webdriver from sel ...

Utilize identical animations across various elements

I have a canvas animation in JavaScript that is currently limited to one canvas element with the id "stars". I want to be able to use this animation multiple times without repeating the code. Is there a way to add a class for the canvas elements instead of ...

Steps to reveal a div when a button is clicked within a v-for loop using VueJS

Context In my code, I am utilizing a v-for loop to display sets of buttons and corresponding input fields. Each button is supposed to trigger the display of its respective input field upon being clicked. Issue However, the problem arises when the button ...

Visual feedback: screen flashes upon clicking to add a class with jQuery

I have successfully added a click event to my pricing tables in order to apply an animation class on mobile devices. However, I am facing an issue where every time I click on a pricing option on my iPhone, the screen flashes before the class is applied. Is ...

What is the best way to choose a specific row with Enzyme?

We have chosen Jest for doing UI Test-Driven Development on our React application. Our component rendering structure looks like this: <Div> <Row> </Row> <ROW> <Row> <ROW> <Link> <Link> ...

What are some alternative ways to retrieve tweets based on a specific keyword in Python without relying on selenium?

Currently, I am able to retrieve tweets from a Selenium bot but it is running quite slow. I need a quicker solution. Thank you in advance. ...

Effective implementation of the useReducer hook across various React components to manage form state

My current project is proving to be quite challenging as I navigate through the step-by-step instructions provided. Initially, I was tasked with creating a BookingForm.js component that houses a form for my app. The requirement was to utilize the "useEffec ...

Tips for Passing Parameters to Vuex mapActions correctly:Executing mapActions in Vuex requires a specific

I am facing an issue with my ProjectPage.vue where I display project issues in a v-data-table. The projects are fetched from a server API call in the sidebar and displayed there. Once I select a project, I want to use its id to retrieve its corresponding i ...

The Control Key in Selenium Webdriver using C# is continuing to be held down

I recently came across an unusual situation while using Selenium Webdriver in C#. In my specific scenario, I needed to open an image in a new tab, manipulate the image, and then close the tab. However, it appears that for some unknown reason, the Control ...

merging 4 arrays in a specified order, organized by ID

i have below 4 array objects var dataArray1 = [ {'ProjectID': '001', 'Project': 'Main Project 1', 'StartYear': '2023', 'EndYear': '2023', 'StartMonth': 'Sep&apo ...

How to access and utilize parent directive methods effectively in AngularJS

Looking for advice on the best way to utilize parent directive methods in its child directive. Option one: Pass it as a scope parameter in the HTML where you initialize the child directive. Option two: Make the parent directive required and gain ...

What could be causing the pause function for videos to stop working in Chrome?

Recently, I've encountered an issue with the pause() function in Chrome while trying to stop a video playback. Despite using this method successfully in the past with Firefox, it seems to no longer work on Chrome browsers. I've simplified my code ...

What are some techniques for preventing Null Pointer Exception errors?

Currently, I am working on a project that involves creating a form with a dropdown field for categories. Based on the chosen category, I need to populate a second dropdown called subcaste using AJAX. To achieve this, I have implemented a method that disab ...

Is it possible to utilize AJAX to load the URL and then extract and analyze the data rather than

I had originally created a web scraping method using PHP, but then discovered that the platform I was developing on (iOS via phone gap) did not support PHP. Fortunately, I was able to find a solution using JS. $(document).ready(function(){ var container ...

A guide to generating numerous SVG paths using a JavaScript function

Creating strokes with similar length but different angles of rotations can be achieved efficiently using JavaScript instead of writing redundant lines of code. The following code snippet demonstrates one way to achieve this: function stroke(rot) { var d ...