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

What is the best way to align the elements to the beginning and place the flexbox container in the center

I posted this plunker instead of the previous one. My goal is to align the flex container horizontally while keeping its items aligned at the start. I want to use align-content: flex-start along with justify-content: center. Currently, if the last row h ...

Navigating through time ranges in Java

Looking for a solution in Java to compare the time of a Date object with a specific time range. The variable Date someDate = new Date(0) starts at the Unix Epoch and is incremented. I specifically need to check if the time of someDate falls between 0000 an ...

The items are misaligned in a horizontal position

The 4 divs are styled with a width of 23% and displayed using inline-block. They have a fixed height of 220px and no margin applied. However, the issue arises as they are not aligning horizontally Despite attempting to adjust the height and width paramete ...

Creating a hover effect on a specific area of a map is a useful technique

Can someone please help me create a hover effect for areas in maps? Below is the code for the map. Thank you in advance! Here is the image. <img src="[CR_kraje_1_úroveň_v1] (imported)" width="770" height="443" border="0" usemap="#map" /> &l ...

What are the best ways to ensure that my side menu, bottom buttons, and content are all responsive

I have been struggling with creating a responsive side menu in my HTML code. Despite my efforts, the side menu contents, buttons, and layout do not adjust properly when resizing the browser window. When I drag the browser size from bottom to top, the butto ...

Struggling with finding the appropriate CSS selector?

I'm struggling to find the correct selector. Let me do my best to explain the situation: I am currently working on a project where I am unable to make changes to the HTML and JavaScript due to dynamic content and other constraints. Within this proj ...

A guide to Java Selenium testing: Extracting data from a CSV file to input into a TestNG test

As I near completion on my project, I have encountered a hurdle in reading specific rows or columns from a CSV file. Currently, my methods and code are functioning correctly. However, the challenge lies in extracting particular data from the CSV file struc ...

What is the best way to interpret HTML codes using Python and Selenium?

Looking to retrieve a link in an HTML path? Here is the code snippet: <div class="btn btn-primary btn-lg"> <a href="https://storage.googleapis.com/audiog-204018.appspot.com/files/hello1574358335.mp3"> Download MP3 </a> < ...

What is the best way to implement a Panel within another Panel for optimal performance?

Looking for some guidance on integrating panels into a game I'm developing. Currently, each panel has its own driver and I need to figure out how to make one panel work inside another. Any advice or suggestions would be greatly appreciated! Here' ...

The absence of Chromedriver.exe in Java Selenium triggers an IllegalStateException

I'm encountering this error message: Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Scott\workspace\Twitch%20Bot%20v2\bin\chromedriver.exe at com.google.com ...

Position an element to the right within a div using the float property

My product page features a range of attributes that can vary from 1 to 4, each sharing a common fieldset class name. I am attempting to position two of the fieldsets side by side and the remaining ones below them in a similar layout. However, achieving thi ...

What is the method to obtain the dimensions of the browser window using JavaScript?

In my JavaScript code, I am trying to retrieve the browser window size and then set the size of a div element accordingly. I have two div elements that should adjust based on the window size. For example, if the window size is 568px, div1 should be 38% of ...

Incorporating a scrollbar when a div exceeds the bottom of the viewport

I am encountering an issue on my webpage with a <div> that contains a <table> with rows of varying heights: <html> <head></head> <body> <div> <table> <tr>... <tr>... ... </ ...

Guide to incorporating the content of a div into an image source using PHP

In extracting a value from an HTML table, I encountered this syntax: $('table#showalluporders tbody tr').click(function() { var tableData = $(this).closest("tr").children("td").map(function() { return $(this).text(); }).get(); $(' ...

Selenium Webdriver - classes that are absent from the Maven repository

I have successfully utilized Selenium Webdriver by downloading the JAR from their official website or code.google. However, I now want to switch my project to utilize the Maven repository. After investigating, I discovered that the required classes for my ...

Vertically Center Image in a Div

I have been struggling to center an image within a div, but all the usual methods like using margin: auto; do not seem to work. I have tried various popular techniques with no success. <style> /* Add a black background color to the top navigation ...

Discover the Magic of Jquery Hover Effect Unleashed

$('.outerBox').hover( function() { $(this) > $('.innerBox').stop(); $(this) > $('.innerBox').slideDown(750); }, function() { $(this) > $('.innerBox').stop(); $(this) > $(&apos ...

Can the footer be adjusted to be full width only?

Is there a way to stretch only the footer on a blogger simple template to full width without altering other elements? I have looked into similar topics, but they mainly focus on WordPress or involve changing multiple elements, which is not suitable for my ...

Tips for locating a MongoRepository Bean instance

I am encountering an issue while attempting to utilize a MongoRepository in my Spring application. The error message states that there is no instance of the MonoRepository Interface present in the context. @SpringBootApplication public class BackendApplica ...

Is there a way to ensure that the text stays positioned behind the initial image even as the window size is adjusted

<html> <head> <title> Example </title> <style> img:hover {opacity : 0.3;} img {z-index : 1; height : 33%; width : 33%; } .first { position : absolute; top: 0%; left: 0%;} .second {position : absolute; top: 0%; left: 33%; ...