Having trouble with closing the login window or accessing the HomePage on makeMyTrip.com

As I attempt to automate the MakeMyTrip website using selenium, a snag I've encountered is that the login window ends up blocking all other elements on the page when running tests.

  1. One approach I took was trying to click elsewhere on the page in an effort to bypass the non-functional login window.
  2. Another tactic was attempting to log in after providing my username and password, however, OTP prompts were thrown into the mix making automation impossible.

Test Steps:

  1. Check the RoundTrip checkbox.
  2. Select departure and destination locations.
  3. Choose dates and execute the search.

Issue: Unable to bypass the login window during automation.

Screen:

https://i.stack.imgur.com/ROPb1.png

If you have any suggestions or insights, they would be greatly appreciated. Thank you.

Answer №1

If you want to click outside of a pop-up, you can use Actions in Java code like this:

public void performClickAction(By element){
    Actions action = new Actions(driver);
    WebElement webElement = driver.findElement(element);
    action.moveToElement(webElement).click(webElement).build().perform();
}
By button = By.xpath("//button[@id="submitBtn"]");
performClickAction(button);

Answer №2

Let's give this a try:-

if (driver.findElement(By.cssSelector(".sidebar-menu li[data-cy='account'] div.autopop")).isDisplayed()) {
            driver.findElement(By.cssSelector(".sidebar-menu li[data-cy='account']")).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

Check for length validation including spaces in JavaScript

My code includes a functionality that calculates the length of characters in a text area using both JSP and JavaScript: <textarea class="textAreaLarge" id="citation" rows="20" cols="180" name="citation" ...

Choosing a date from a jQuery datepicker-Ui with Selenium WebDriver

Is there a way for Selenium web driver to choose a specific date from a jQuery datepicker-UI and input it into a date field? 1) I attempted using Jscript to set the date, but it seems that the date must be chosen from the jQuery pop-up window for the form ...

Angular encountered an issue with an HTTP POST request, as the 'Access-Control-Allow-Origin' header was not found on the requested resource

I have been attempting to transmit data to a servlet using Angular HTTP POST requests. var httpPostData = function (postparameters, postData){ var headers = { 'Access-Control-Allow-Origin' : '*', &a ...

There seems to be an issue with the AJAX REST call failing to transmit data

Whenever I attempt to submit the form, the page refreshes and nothing gets saved in the database. The code in subforum.js $(document).on('click','#submit',function(e) { var user = JSON.parse(sessionStorage.getItem("ulogovan")); consol ...

Exception encountered for Internet Explorer when attempting to launch from WebDriver: 405 Method Not Allowed

After trying to launch IE from Webdriver and clicking on save, I encountered a "405 Method not allowed" exception. However, when I manually launched IE and clicked on save, it worked fine. I'm perplexed by this issue. Any ideas as to why it might be ...

When implementing Ajax with a Spring controller, it will redirect the user to a different location

I am currently working on developing a Spring MVC application similar to a "Cinema" app. I have implemented a RestController with a Get method that produces JSON responses. private SessionService sessionService; public SessionController(SessionService ses ...

The Follow/Unfollow button fails to function properly when attempting to unfollow by using the same ajax call

A scenario where dynamically generated buttons (anchors) are displayed on a page, each with a unique ID and a common class. With the class, I am able to retrieve the ID using jQuery and send it to the controller for processing. Although I can successfully ...

By pressing the "showMore" button, the page dynamically pulls in a json list from a file

Currently, my focus is on a dropwizard-Java project. My task involves retrieving and showcasing the first 10 items from a json list in a mustache view. If the user clicks on the "show more" link, I should retrieve the next 10 elements from the list and d ...

Utilizing dynamic JSON lists in Spring MVC

Currently, I have a new form for Person that includes a table of objects structured like so: <table class="table table-striped table-condensed flip-content"> <thead class="flip-content"> <tr> <th width="20%"> ...

Send an array to Spring's controller using AJAX

I am currently encountering an issue while attempting to send an array of objects to a Spring controller using jQuery AJAX. Below is the snippet of Javascript code being utilized: var data = new Array(); $.each(products, function (i) { ...

I'm curious if it is possible to retrieve the dates of actions on websites using Selenium with Python

Is there a way to retrieve the date of data, like the date of comments, using HTML codes? I need assistance on how to achieve this through selenium in Python. Can Jquery be used as a solution? ...

Dealing with Spring MVC: Error 415 when converting JSON to Pojo

While working on my jQuery code, I am creating JSON data and sending it to a controller using ajax. Here is the code snippet: var jsonResponse = []; $(columns).each(function() { if(!isEmpty($(this))) { var lang = $(this).find(".language"). ...

The second JSP page fails to load following an AJAX POST request

The following code snippet is found in page1.jsp. $.ajax({ type: "post", url: "page2.jsp", data: newdata, success:function(msg){ return msg; } ...

Encountering issues with the transmission and retrieval of ajax data in Struts 2 framework

Currently, I am attempting to transmit data through ajax and then retrieve the same using ajax. Below is the snippet of my ajax code: $.ajax({ url:"getSampleData", type:'GET', data : {'var':cellValue}, ...

The data is not being successfully transmitted to the controller method through the AJAX call

In my JavaScript file, I have the following code: $(document).ready(function () { $('#add-be-submit').click(function (event) { event.preventDefault(); $.ajax({ type: 'POST', url: '/snapdragon/blog/new&apos ...

A comparison between XPath and JQuery locators when using Selenium

After discovering that individuals utilize JQuery element-locators in Selenium, I am intrigued by the concept. I would like to inquire about the advantages of using JQuery selectors over XPath selectors. Are they considered more adaptable or quick, parti ...

Exploring the drag-and-drop feature in Ruby on Rails version 3

Is there a way to replicate drag and drop actions in rspec request specs? In my scenario, I need to move the #divItem element to the #divContainer element using jQuery. After refreshing the page, I want to verify that the #divItem is now inside the #divCo ...

Tips on sending non-form values to an action in Struts 1.3 via AJAX

Here is a snippet of JSP code that I am working with: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> < ...

Effortless File Uploading in JERSEY using jquery and AJAX

I'm looking to achieve file uploads with Jersey through jQuery/AJAX, but I'm struggling with extracting the file from the input and sending it via AJAX. Below is my current code: HTML <form action="rest/files/upload" method="post" enctype=" ...

I am looking to transmit information to the controller using AJAX

ajax console.log(total);//10 console.log(number);//4 var form = { total:total, number:number } $.ajax({ url: 'items/cart/update', type: 'POST', data:form }); Spring MVC controller @ResponseBody @P ...