Fields are unable to process the input provided

While testing my website's cart functionality, I encountered an issue with inputting data into the Debit card fields after selecting the Payment method. How can I successfully enter data into these fields? You can access the Website to be tested via this link: . Below is the code snippet for entering data into the fields:

    wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[contains(@name, 'zoid__paypal_buttons')]")));
System.out.println("We have selected Credit card method");
Thread.sleep(5000);

WebElement debitCreditCardButton = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='Debit or Credit Card']")));
debitCreditCardButton.click();
Thread.sleep(5000);
        
driver.switchTo().defaultContent();
js.executeScript("window.scrollBy(0,800)");
//Encountering an issue here - unable to locate element
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id="credit-card-number"]"))).sendKeys("4111111111111111");

Answer №1

There are nested iframes within the code:

Look for the card number inside the following element:

div[id^='zoid-paypal-card-fields-uid_']

This element is inside an iframe.

Use the following code snippet:

debitCreditCardButton.click();
Thread.sleep(5000);
driver.switchTo().defaultContent();
js.executeScript("window.scrollBy(0,800)");
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("div[id^='zoid-paypal-card-fields-uid_']")));
// Now input the card number into the input field

wait.until(ExpectedConditions.elementToBeClickable(By.id("credit-card-number"))).sendKeys("4111111111111111");

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

The hover functionality is not functioning as expected on the demo website when using Selenium WebDriver

I have attempted to use the following code. public class LocateMultipleItems { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); dr ...

Unable to utilize IE and Chrome WebDrivers following the addition of pom.xml

Upon the Maven requirement, I incorporated pom.xml into the project and made the necessary adjustments to transition the existing project into a Maven-based one. Here is the error stack trace encountered while starting IE WebDriver, a similar issue occurs ...

Creating an xpath with ::before and ::after pseudo-elements in selenium

Line 1 -> <input _ngcontent-huh-c120="" name="options" id="line" type="radio" ng-reflect-name="options" ng-reflect-model="0" ng-reflect-value="0" class="ng-untouched ng-valid ...

Utilizing Selenium with Java: Extracting Data from a Single Dropdown Menu (Time Selection)

Hey there: I am facing an issue with extracting data from a calendar field. I am trying to extract the information (HH.MM.AM/PM) from a single date field, but so far, it has been unsuccessful. This is the code snippet I have been using: WebElement currT ...

Tips on selectively crawling specific URLs from a CSV document using Python

I am working with a CSV file that contains various URLs with different domain extensions such as .com, .eu, .org, and more. My goal is to only crawl domains with the .nl extension by using the condition if '.nl' in row: in Python 2.7. from selen ...

Retrieving availability using the datepicker

My attempts to retrieve the daily price on Homeaway by clicking the next button in the datepicker calendar have not been successful. Here is a snippet of my current code: def handle(self, *args, **options): def homeaway(self): display = Displ ...

Attempting to confirm the accuracy of a data point within an extensive and interactive online table

I am facing a challenge in verifying a specific value from a large web table because none of the locators are unique and Selenium is unable to find all the elements. I am using Selenium and Cucumber JVM for automation. Below is a snippet of the HTML code ...

An incident of TooLongFrameException occurs while utilizing Selenium in conjunction with BrowserMob

When utilizing Selenium with BrowserMob for testing purposes, I implement requestfilter and responsefilter to adjust the request header and response contents as follows: public void proxySettings(){ proxy.addResponseFilter((response, contents, messag ...

Watir does not have time to wait for the page to finish loading

Currently, when loading a page and clicking on an element within that page, I am relying on the sleep function. However, I find this method to be unreliable as the element disappears after some time. Clicking on (page1).buttonForNextPage @myvariable = ...

What could be causing the slow start to my feature tests using Rails, Selenium, and Spring?

My Rails 5.0.5 application has feature tests that utilize Capybara and Selenium with chromedriver. Despite using spring, the first request to my app during the feature tests takes around 45 seconds before subsequent requests return to normal response times ...

Issue encountered when executing mvn with selenium testing

I recently started using Selenium and encountered an issue after running mvn verify with my test included in the code. My setup involves Java Junit with WebDriver. Below is a snippet of my test code: import java.util.regex.Pattern; import java.util.concu ...

Unable to make an AJAX call to a Spring controller

I am currently attempting to make an ajax call to a Spring controller, but I am encountering an Error 405 stating "Request method 'POST' not supported." I have included my code below and would appreciate any suggestions on how to resolve this iss ...

Is it possible to use Webdriver (ChromeDriver) alongside Play framework?

Currently, I am facing an issue with ChromeDriver within the Play! framework. In my UnitTest, I have instantiated ChromeDriver to make a get request to my Dyndns URL. However, upon initiating the test, Chrome opens, makes the request, but unfortunately, th ...

How can I properly retrieve an entry for processing within my route?

Hello everyone! This is my first question on this platform, so please bear with me if I'm missing any important details. I'll add them as soon as possible. I am currently working on setting up a camel route where I retrieve a URL from my Databas ...

Gson throwing an error with an unparsable date format?

I am encountering an issue while attempting to parse JSON data with a Java POJO class. Below is the JSON and POJO structure: JSON: { "startDate": "2018-09-18T12:00:00+0000", "endDate": "2018-09-18T14:00:00+0000", "startDateAsDate": 153 ...

Utilizing Selenium in Python to scrape data from a dynamic website

Currently, I am exploring ways to automate a task and perform web scraping on a dynamic website. The specific site in question is: Upon retrieval, it loads a javascript which has made the process slightly challenging. Despite my attempts using Selenium a ...

Validating the download dialog window with selenium

I'm currently working on a website and using selenium for integration testing. On the page, there is a link that is created using various variables. I want to make sure that when I click on this link to download a file, the download pop-up box appear ...

AssessmentMonitor using Selenium

I have implemented TestWatcher to perform certain actions based on test output. However, the function that I need to call, createScreenShot in testFailed, requires a driver as an input parameter. Unfortunately, the driver is protected and not static, as al ...

Navigating through WebTables with a Horizontal Scroll Bar using Selenium

I am tasked with automating a WebTable that is embedded in the WebPage. The table contains numerous fields, causing it to have its own horizontal scrollbar separate from the rest of the WebPage. As a result, when attempting to interact or click on elements ...

A guide on how to extract the element id containing a random string in Selenium

While utilizing Selenium with Python, I am attempting to input a value into the textarea using send_keys. However, I am facing difficulty in obtaining the id as it contains a random string. <div class="XiG xcv L4E zI7 iyn Hsu"> <text ...