The button is not displaying

When trying to click on the "Open device Access" button within the accordion, it does not appear. It seems like there may be an issue with the JavaScript as the transition from "display none" to "display block" is not functioning properly. The "Open device access" button remains hidden even after clicking on the accordion.

HTML code :

<div id="device_hmi_content_22">
    <div id="accordion_device_hmi_22" class="accordion">
        <h2 class="accHeadline accHeadlineClosed">Device Access</h2>
        <div class="accContent accContentClosed" style="display: none;">
        <div class="submit">
        <input type="button" onclick="onOpenSessionClick()" value="Open device access">
    </div>
</div>

JavaScript code :

driver.findElement(By.xpath("//a[@href='/mybox/devices/satellite.php']")).click();
Thread.sleep(5000);
driver.findElement(By.id("device_hmi_content_22")).click();
WebElement element2 = driver.findElement(By.xpath("//input[@value='Open device access']"));

if (isElementPresent(By.xpath("//input[@value='Open device access']")))
{
    driver.findElement(By.xpath("//input[@value='Open device access']")).click();

Answer №1

One way to make those buttons appear is by using the JavaScript executor:

driver.findElement(By.xpath("//a[@href='/mybox/devices/satellite.php']")).click();
        Thread.sleep(5000);
        driver.findElement(By.id("device_hmi_content_22")).click();

        JavascriptExecutor jse = (JavascriptExecutor)driver;
        jse.executeScript("window.document.getElementsByClassName('accContent accContentClosed')[0].style.display='block';");

        WebElement element2 = driver.findElement(By.xpath("//input[@value='Open device access']"));

       if ( isElementPresent(By.xpath("//input[@value='Open device access']")) )
                {
                   driver.findElement(By.xpath("//input[@value='Open device access']")).click();

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

Utilizing Async.each fails to trigger the ultimate callback function

Here's the scenario: I expect the function finalCallBack to be triggered after we finish looping through all elements. var rows = [ { name: 'first'}, { name: 'second'} ]; var execForEachRow = function(row, callback){ var ...

When there is an absence of data, the jQuery datatable mysteriously van

I have encountered an issue in my Django app where a datatable used in the template disappears if there is missing data in any column or row. The problem occurs when trying to download the data in CSV, Excel, PDF, or copy format. Here is the HTML code snip ...

Verify whether a document retrieved from mongoDB contains a certain property

Dealing with user accounts in Mongoose, I have set it up so that the user can use their phone number to sign in: const account = await db.Account.findOne({ phone: req.body.phone }) : Now, I need to confirm if there is a property named verified in the acco ...

Utilizing the 'container' property in a React.js React-Bootstrap modal

How can I open a modal within a designated container using the native property "container"? Whenever I specify the class name of the container element, I encounter an error TypeError: Cannot use 'in' operator to search for 'current' in ...

Guide to creating an asynchronous function

Starting my first react website and needing assistance with writing an asynchronous JavaScript function. I am currently working on uploading user input files to firebase storage and then making a post request to the API in order to store the data in the da ...

How to access a $scope variable in the same Angular controller function from outside the function

As a newcomer to AngularJS, I have a question about accessing my $scope variable from an outside function within the same controller. How can I achieve this? Below is the code snippet: .controller('RekapCtrl', ['$scope', '$timeout ...

Locate elements within an array based on certain internal characteristics

I have an array of objects that contain a property called "distributionChannel". I need to find objects within the array that have a value of "sellChannel" for the key in the "distributionChannel" property. Here is my array: [ { "lineItems": [ ...

Triggering jQuery events can be customized by excluding certain elements using the

Is there a way to hide the div "popu" when clicking on the img "tri"? I've tried using .not() since the img is a child of the div popu, but it didn't work. Also, I need to make sure that clicking on the div "textb" does not trigger the hide actio ...

Having difficulty creating JSON data following retrieval of rows by alias in MySQL

I am encountering an issue while trying to fetch rows from two tables using a JOIN and aliases. The problem arises when I attempt to convert the fetched rows into JSON data and assign them to a JSON array. Below is the code snippet: $personal = $db->p ...

Choose the date that is exactly 48 hours from now

I need to implement a date picker that shows today's date and the next 2 days in a select component. Can this be achieved using JavaScript and jQuery? While I came across a similar post on the topic, I specifically want it to work with a date picker: ...

Is iterating through object with a hasOwnProperty validation necessary?

Is there any benefit to using hasOwnProperty in a loop when an object will always have properties? Take this scenario: const fruits = { banana: 15, kiwi: 10, pineapple: 6, } for (let key in fruits) { if (fruits.hasOwnProperty(key)) { ...

Using C# Selenium to Automate Form Submissions

I am experiencing some issues with the process of checking if a submit form is available, submitting data, and then processing the response. Below is an example code snippet illustrating the problem: if (driver.FindElements(By.Name("search")). ...

Cross-origin resource sharing (CORS) policy issue arises when the 'Access-Control-Allow-Origin' header is not included in the requested resource, especially when utilizing an iframe in a React

I am trying to link a website to a button using an iframe. This website allows access to all domain names. Below is the code for my button: <Button component={NavLink} activeClassName={classes.activeBtn} to="/searchEngine&qu ...

Executing external Javascript within an HTML document

Just diving into this realm, so please have patience with me. I've got an external js file linked in my HTML. The JS code is solid and functions properly in Fiddle - https://jsfiddle.net/0hu4fs4y/ <script src="js/noti.js"></script> <sc ...

Line breaks in Vue v-tooltip functionality

Currently, I am implementing v-tooltip to add tooltip text to a button. My aim is to include a line break within the tooltip text, but I have been unable to determine if this is feasible using this method. After reviewing the documentation, I did not find ...

Using jQuery to update a specific item in a list

My current project involves developing an Image Gallery app. It uses <img> tags within li elements. The code snippet is as follows: var $slideR_wrap = $(".slideRoller_wrapper"); var $slidesRoller = $slideR_wrap.find(".slidesRoller"); var $slideR ...

Angular ERROR: Trying to access rating property of an undefined value

I'm encountering an issue on a website where users can vote for their favorite animal. Whenever I try to select an animal to vote for, I receive an unclear error message that has been difficult to resolve even after searching online for a solution. A ...

How to Handle Non-Conventional JSON Parsing in AngularJS

When retrieving a JSON response from a Restful service, the format may not always be accepted by Angular. For example: { "comments":{ "columns":[ "clientId", "treatmentDate", "comments", "photo", "pra ...

Using Selenium Webdriver with Python for navigating through classified ads on leboncoin, encountering difficulty in selecting a dropdown list and input box

Continuing my journey on the Python/Selenium learning curve. Selenium Webdriver - Python - leboncoin - Issue with selecting a button containing an accent After successfully logging in to the site and selecting the button, I aim to populate the fields for ...

Guide to initiating a node.js socket.io server through a brackets extension

I am currently working on developing a brackets extension that involves sending data to a server. What I aim to do is execute a server.js file from my main.js file, which will create a node.js socket.io server. Once this server is set up, the extension sho ...