The code runs smoothly in Javascript, but unfortunately does not work in Selenium

Upon executing the code

"document.getElementsByClassName("jobs-company-card__cta-link ember-view");"
in the console using JavaScript, it returns the elements with that class name. However, when I run the code:

driver.findElements(By.className("jobs-company-card__content-wrapper"));

An empty List is returned with no element found.

Answer №1

Resolved! This simple solution did the trick:

WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.jobs-company-card__content-wrapper")));

Answer №2

Maybe consider utilizing CSS selectors as an alternative?

driver.findElements(By.cssSelector(".jobs-company-card__content-wrapper"));

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

Personalized function callback for jQuery extension

Looking to integrate this particular example into my project. I do not have much expertise with jQuery and have not worked extensively with JavaScript objects in the past. What I would like to achieve is a simple modification on this plugin so that it tri ...

Developing a fresh framework using the _family entity within the FHIR system

Is there a way to implement the FHIR structure in Java? { "resourceType": "Patient", "name": [ { "family": "Family1-Family2", "_family": { "extension": [ ...

Is it possible to control v-mask in Vue?

One challenge I am facing is with an input tag that utilizes v-mask for formatting a mobile number: <input type="text" placeholder="Phone Number" id="phoneNumber" class="form-control" v-model="numberAndCap ...

Issue with uploading media on Wordpress: "Unfortunately, an error occurred during the upload process. Please attempt again at a later time."

Often times, when trying to upload media from the front-end, I encounter this issue: An error occurred during the upload process It seems like the error occurs sporadically, making it even more challenging to troubleshoot. Sometimes, when logging in fo ...

Converting JSON data into CSV format and saving it in a variable: A guide

How can I convert JSON data to CSV format using JavaScript and save it in a JavaScript file? The data includes information about Apple iPhone 4S sales being cancelled in Beijing. Here is a sample of the JSON data: { "count": 2, "items": [{ "title" ...

"Trouble arises when trying to import a Vue component into a TypeScript file

Within my Vue project, I have created a new TypeScript file named Validation.ts: import Vue from 'vue'; import BaseInput from '@/components/base/BaseInput.vue'; class ValidationService extends Vue { validateFields(fields: BaseInput[] ...

Changing visibility when class is removed with display: none

I have a collection of div elements, some of them are currently hidden using the class "not-updated", while others are visible. .not-update{ display: none } With certain AJAX calls, some of these hidden divs may become visible by removing the ...

Troubleshooting: Why is Spring MVC failing to return results on ajax call?

I am trying to retrieve user data through an ajax request, but I am facing an issue where the success part of the request is not being reached and no logs are being generated. This is the controller code: @Controller @RequestMapping(value = "/api/profile ...

Transmitting personalized information with Cylon.js and SocketIO

After making adjustments to my code based on the example provided here https://github.com/hybridgroup/cylon-api-socketio/tree/master/examples/robot_events_commands This is the complete server code, currently running on an Edison board. Everything functio ...

Click on the link to go to another page according to the drop-down option selected

Here's a puzzling query that even Google fails to address. I've got two pages: page-1 and page-2. On page-2, there is a <ul> element and a toggle-button-box with the following code: <ul> <li><button class="button is-checked ...

What is the best way to design a dynamic menu using HTML, CSS, and jQuery, where each li element gradually disappears?

Consider this menu structure: <ul class="main-menu"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> </ul> My task is to dynamically hide th ...

Issues with events not properly attaching to elements within Angular Directives

In my current Angular app project, I've encountered an issue with ng-click not binding to an element that is brought in via a Directive. The app itself is focused on goal planning and this particular section tackles the obstacles individuals face when ...

Structuring Server Side Code with Node.js and Express

I am faced with the task of restructuring my server and its components. My goal is to streamline the process by segregating different functionalities. app.post("/login", function(request, response) { }); app.post("/register", function(request, response) ...

Utilizing the button's id to display a partial view within Rails

I am working on a view that showcases a partial containing a list of events created by a user, each with an edit link alongside. My goal is to have a form partial appear below the event when the 'edit' link is clicked. To achieve this, I have su ...

Revamp MUI class names with React Material UI's innovative randomization and elimination

Can names be randomized or Mui-classNames removed? https://i.stack.imgur.com/J6A9V.png Similar to the image displayed? (All CSS class names would be jssXXX) Appreciate your assistance. ...

Tips for closing process.stdin.on and then reopening it later

I've been facing a challenge with an exercise. In this exercise, the client will input a specific integer x, followed by x other y values separated by spaces. The output should be the sum of each y value, also separated by spaces. For example: Input: ...

retrieve the value of the Firebase object's name property using ng-repeat

I am searching for a way to utilize a Firebase Object name as a parameter for the ui-router within an ng-repeat. It is important to note that fetching the favorite property as a Firebase array is not feasible. STRUCTURE OF THE OBJECT: https://i.sstatic. ...

Exclude undefined values from an array in React using JavaScript

I am working with an array of objects that contain content types const contentTypes = [ { "contentType": { "content_type_id": 2, "content_type": "image", }, }, { ...

The search feature in AngularJS with filter appears to be malfunctioning

I've been attempting to use the angularjs filter method for searching, but it doesn't seem to be working correctly. Despite not seeing any errors in the console, the search results aren't showing up. Can someone lend a hand with this? Below ...

What is the process for unbinding an externally created event in a directive?

Is there a way to prohibit copy-pasting in the Textangular module without modifying its code? While examining the code, I discovered an event binding for the "paste" action. Could the paste event be unbound from outside the module? Perhaps upon loading th ...