Perform a compound class context click using Selenium

Currently, I am attempting to locate the element within the compound class

sfnDialOrChartPanel sfnEditBorder
using the method
findElement(By.cssSelector(".sfnEditBorder"))
. Although it seems to be locating it correctly, when a context click is performed, no menu appears as expected.

Could I possibly be incorrectly utilizing the CSS selector? Is there a way to display the selenium mouse location in order to see exactly where the right-click action is being executed?

Thank you

Chris

Actions actions = new Actions(webDriver_);
WebElement masterPanel = webDriver_.findElement(By.cssSelector(".sfnEditBorder"));
actions.contextClick(masterPanel);

I attempted to check if there were multiple occurrences of .sfnEditBorder by doing the following...

List<WebElement> masterPanel = webDriver_.findElements(By.className(".sfnEditBorder"));

However, only one instance was found. Any other suggestions?

Answer №1

I realized I wasn't actually performing the right click action correctly. The correct method is to call actions.perform();

Actions actions = new Actions(webDriver_);
WebElement mainWindow = webDriver_.findElement(By.cssSelector(".sfnEditBorder"));
actions.contextClick(mainWindow);
actions.perform();

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

Prevent jquery tabs from automatically jumping to the top of the page

On a website, I have implemented tabs using jQuery to display 4 different pages of data without needing to refresh the entire page. Everything is working smoothly, but there is one slight issue that I would like to address. When I scroll down on the first ...

"Refreshing Your Internet Experience with Netbeans Chrome: A Guide to Clear

While developing an HTML / CSS / Javascript / PHP app in Netbeans, I've noticed that making changes to the HTML requires me to 'clear browsing data' in Chrome for the updates to show. I believe it's the 'cached images and files&apo ...

Clicking on an element with ng-click does not impact the children of its parent

Why isn't this working as expected? I performed a field test. However, when I click on the <p> element inside child1, it doesn't have any impact on the <p> within child2. <div ng-init="test=false"> <div id="child1"&g ...

Tips for utilizing the jQuery selectbox plugin on multiple elements within a single page

On my webpage, there are 3 select boxes that I want to customize using a jQuery selectbox plugin. However, the issue I'm encountering is that the plugin only works on the first select box and the others remain unchanged. Does anyone know why this mig ...

Ensuring the validation of checkboxes using the Bootstrap framework

I am currently working on validating checkboxes using JavaScript. If the validation fails, I want to display a div with the class invalid-feedback below the checkboxes. However, when I add the invalid-feedback class to my div, it simply disappears. < ...

Adjusting the tab size and space size to their default settings within VSCode

I'm currently facing an issue with my VSCode setup. I am trying to configure the space size to be equal to 1 and tab size to be equal to 2 as the default for every project. However, despite my efforts, it keeps reverting back to spaces: 4 for each new ...

Error occurs when executing Java tests with Circle CI due to a delay in starting the driver server

I have just begun utilizing the Circle CI tool to run my Java autotests (using Selenium and Maven). This is my Java code: public void setUp() { WebDriverManager.chromedriver().setup(); webDriver = new ChromeDriver(setOptions()); ...

How to use CSS to dynamically adjust the maximum width of an overflow container based on its children's content

I have a container with an overflowing <div> that displays multiple <ul> <li> lists. Each list always contains the same number of bordered <li> items, resembling a table. However, there may be instances where a <ul> has only ...

Tips for implementing multiple login functionalities using shared preferences:

After following a tutorial on using SharedPreferences from here, I was able to successfully implement it for one user. However, when I tried adding some additional code with a similar structure, the app always redirected me to the MainActivity instead of t ...

Ways to incorporate void functions

I am in need of showcasing the given data Type in array size: 3 Enter student name: jane doe Enter student id number: 14234567 Enter student name: john doe Enter student id number: 12345678 Enter student name: peter griffin Enter student id number: 142382 ...

Encountering a NullPointerException when transferring inputs from scala.html to Controller as a form in Play framework (version 2.8.*) using

I am currently developing a Java web application using the Play Framework (2.8.19). In the process of creating a registration page, I encountered an issue with passing inputs from the registration page written in Scala to the controller class that is respo ...

Converting XML to Java REST API using Spring Boot

I am currently in the process of developing a Spring Boot REST API that must accept data in XML format. Once I have successfully received the data in the controller, I can proceed with the implementation. My main question is, how can I make the controller ...

What is the best way to retrieve the value or string of an element in Selenium using Python?

I am looking to develop a bot that can automatically generate Instagram accounts using Selenium and Python for educational purposes. However, I have encountered an issue where I am unable to retrieve the text of an element created by the random string gene ...

Display images that have been uploaded on the page either as a grid view or a list of

In my Reactjs application, I am uploading multiple images to Azure Blob Storage. On a page, there is a button to open the upload form. Once the upload completes, I want to display all these images on the same page. Since the images have different aspect ...

The paragraph element is refusing to align with the next paragraph element on the following line

The issue I'm facing is that the paragraph element is not displaying on a separate line from the other paragraph element. body { margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; backgr ...

Unable to dispatch the form on a connected page using jQuery Mobile

I have encountered an issue while trying to submit a form using jQuery Mobile. The problem arises when the form is placed on a linked page, as it fails to submit properly. To illustrate, if my home page is mysite.com/page.html, placing the form code on tha ...

Step-by-step guide to implementing a month and year date-picker in Mozilla Firefox

I'm looking to create input fields where users can add the month and year. I tried using the code below, but unfortunately Mozilla Firefox doesn't support it. <input type="month" id="start" name="start"> Does ...

Utilize jQuery to locate and remove entire rows containing cells with specific text

Currently, I am exploring table manipulation with jQuery. My objective is to scan an entire column based on its header to identify specific values. Once these values are identified, my goal is to delete the entire row containing that value. At this point, ...

Determine whether the server request originated from an Ionic mobile application

Currently, we are in the final stages of completing an Ionic project with a PHP backend. To enhance the security of our backend and protect it from external influences, we aim to restrict access to the backend only from within the Ionic project (native app ...

The formatting of ASP.Net MenuItems is not cascading down to the child items

I am facing a challenge while building an ASP.Net 4.5 menu programmatically in C#. The main issue is that the formatting of the child items is not inheriting from the top menu items as expected. Specifically, I am struggling with two formatting aspects: St ...