IntelliJ automation in Java does not allow clicking the button

Currently, I am on the PayPal page and I need to automate clicking the agree button.

<form id="ryiForm" class="proceed ng-pristine ng-valid" ng-class="{true: 'validated'}[validated]" ng-submit="confirm.$valid && onPay()" novalidate="novalidate" name="confirm">

    <!--         {@if cond="'{data.updated}' === 'bmlSuccess'" }         -->
    <!--         ngIf: merchantMsg         -->
    <div class="reviews ng-scope" ng-if="merchantMsg"></div>
    <!--         end ngIf: merchantMsg         -->
    <!--         ngIf: showShippingAddress         -->
    <div class="reviews"></div>
    <div class="offers"></div>
    <!--        inc/bmlLearnMore        -->
    <div></div>
    <!--        Action button         -->
    <!--         ngIf: showPaypalPolicies         -->
    <p class="paypalPoliciesLink disclaimer ng-binding ng-scope" ng-if="showPaypalPolicies" data-ng-bind-html="htmlContent('memberReview.viewPaypalPolicies')"></p>
    <!--         end ngIf: showPaypalPolicies         -->
    <!--         checkoutSession.isRT need to review this         -->
    <!--         ngIf: showReviewLater         -->
    <!--         ngIf: checkoutSession.isAuthRequired         -->
    <!--         ngIf: showPolicyAgreement         -->
    <!--         ngIf: showFixedButton()         -->
    <div id="button" class="buttons reviewButton">
        <input id="confirmButtonTop" class="btn full confirmButton continueButton" type="submit" ng-click="setValidated()" value="Agree & Continue" track-submit=""></input>

    </div>
    <!-- ngIf: checkoutSession.plan.soft_descriptor -->
    <!-- ngIf: checkoutSession.displayBankChargeDisclaimer…   -->
    <!-- ngIf: checkoutAppData.flags.billing_address_conse…  -->
    <!-- ngIf: checkoutSession.plan.isAuthSignupEnabled ||…-->
    <!-- ngIf: checkoutAppData.flags.display_buyer_email_p… -->

</form>

In order to click the element with id=button on this page, I have tried using xpath, css, and id for all elements, but I always encounter the error "Element is not clickable at point (353, 447). Other element would receive the click: ..."

Below is my code:

@FindBy(id="confirmButtonTop")
 public static WebElement agreeButton;
WebDriver driver;

public PaypalReviewPage(WebDriver driver) {
    this.driver = driver;
}

public void completePaypal() {
     agreeButton.click();
}

If anyone has a solution, please help. Thank you.

Answer №1

After making a minor code adjustment,

public boolean processPaypalPayment() throws Exception {
try {
    Thread.sleep(10000);
    WebDriverWait wait = new WebDriverWait(driver, 60);
    WebElement PayPalAgreeContinueBtn = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='confirmButtonTop']")));
    PayPalAgreeContinueBtn.click();
    Thread.sleep(5000);
    return true;
} catch (Exception e) {

    return false;
}

}

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

Overflow of text arranged horizontally within a span element situated inside a div container

I am currently working on developing a ticketing system that involves using nested div elements to organize content. Each ticket is represented by a main div containing various other nested divs and media such as images. While the functionality of the sys ...

Issues with Selenium web scraping on an ec2 instance: element cannot be located despite functioning properly on local machine

Attempting to extract data from a webpage, the following code successfully runs on my local Windows machine but fails on an EC2 Linux instance. from selenium import webdriver from selenium.webdriver.common.keys import Keys option = webdriver.firefox.o ...

Looking to implement a CSS effect that will hide content without removing the space it occupies on the page?

Is there a way to hide specific buttons within the right column of a 3-column table display? I am currently utilizing jQuery to achieve this function. The purpose behind hiding these buttons is to prevent any quick clicks that might interfere with the fa ...

The Art of Selenium Parameterization

I attempted to automate Gmail using the code provided below. In the initial function, the browser successfully locates and clicks on the "Compose" element. However, it fails to find the subsequent elements like "to" and "subject". I have specified these el ...

How to easily center text across multiple lines using CSS

Looking for a way to center text horizontally and vertically within a div? I had it all working perfectly with this code snippet from a Stack Overflow post: text-align: center; vertical-align: middle; line-height: 90px; /* set line height to match you ...

Creating a CSS layout that eliminates the need for a vertical scroll bar

Currently, I am experimenting with creating an HTML CSS Layout using the div tag. You can view the code here Currently, the layout displays a vertical bar that I would like to eliminate. Ideally, I only want it to display if the content is lengthy. ...

Slider with Dual Images: A Visual Comparison

I'm currently working on a webpage that features before and after images using a slider based on mouse movement to display both pictures. I am trying to incorporate multiple sliders on the same page but have been facing difficulties in getting them to ...

Struggling to decode JSON in Java using Gson, encountering MalformedJsonException

I've been working on retrieving weather forecast data from the WeatherUnderground API. Here's the code I have so far: URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.connect(); JsonParser jp = ne ...

What methods can be employed to ensure the image URL remains consistent when scraping with Selenium?

I'm having trouble scraping the cover photo from Facebook using Python selenium Although it initially returns the correct URL, the image displayed is blurry and different. from selenium import webdriver from selenium.webdriver.common.by import By imp ...

Users using an iPhone are unable to adjust the scale or scroll on this website

I find myself wondering what I might be overlooking in this situation Here is the HTML code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="shortcut icon" href="../../nImg/favicon.ico" ...

Exploring Font Choices: Customizing Your Text Style

I've been attempting to incorporate my own font into my website, but despite researching several Stack Overflow articles, I'm facing various browser-specific and path-related issues. Sadly, I haven't been able to successfully display my font ...

sliderLighter: keep the slider moving smoothly at a constant speed

I am currently utilizing lightSlider and I want to create a continuous sliding effect with consistent speed. I do not want any stops or pauses between the images, just a smooth and constant movement. Is it possible to achieve this using lightSlider? Or per ...

Preserve the authentic picture along with a blur mask that can be dragged and applied to it

Is there a way to preserve the original image while having a draggable blur mask over it? If you want to see an example of a draggable blur mask over an image, you can check out this link: https://codepen.io/netsi1964/pen/AXRabW $(function() { $("#ma ...

Efficient Ways to Utilize Global CSS in an Angular Project Without CLI

I am utilizing ASP.NET MVC as the server and Angular as the client application. Instead of a static index.html file, I have index.cshtml. The styles I am using are global styles rather than component-scoped. My query revolves around working with a bunch ...

Ensuring Proper Highlighting for HTML Select Options

I am working on a project involving an HTML Drop-down menu. Check out the code I have so far: http://jsfiddle.net/dineshk/u47xjqLv/ HTML Code <select> <option class="first" style="display:none;">HH</option> <option class= ...

Encircling the icon with a circle

My styling skills are limited, but I'm attempting to create a marker that resembles the image linked below: https://i.stack.imgur.com/wXkaq.png. So far, I've made some changes in the code snippet provided, but I'm struggling to get it to d ...

Exploring Resource Options with JAX-RS

Using a JAX-RS interface with XMLHttpRequest (XHR) involves the XHR preflight, where OPTIONS is always sent before calling the actual resource. With numerous methods in place, it becomes tedious to manually include OPTIONS for each resource. Is there a wa ...

Here are the steps to resolve the error message: "selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element"

I am currently in the process of learning Selenium. My focus is on creating a script that can add multiple items to a shopping cart. Interestingly, when I removed the class from my script, it allowed me to successfully add an item to the cart. However, on ...

Unable to perform downward scrolling in Chromedriver using the Selenium WebDriver in Java

I've been experimenting with scrolling functionality using Selenium Webdriver. It seems to work fine in Firefox, but I'm encountering issues when trying it in Chrome driver. Below is the basic code snippet I'm using for scrolling: Actions a ...

Having issues changing the color of fontawesome icons

I am struggling to change the color of a fontawesome icon when it is clicked. <a id="thumbsup">@Html.FontAwesome(FontAwesomeIconSet.ThumbsUp, FontAwesomeStyles.Large2x)</a> My goal is to have the icon start off as gray, turn blue when clicke ...