Master the art of capturing the Auto Suggest Pop Up notification using Selenium

I'm currently attempting to capture a pop-up message that appears when the cursor is placed in the "Choose Your Username" text box on the Gmail create account page. The message says "You can use letters, numbers, and periods." I want to save this message in a variable and then print it to the console. However, I am having trouble finding the element either by ID or XPath.

Below is the code I have written:

package Default;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class HandlingAjaxAutoSuggests {

WebDriver oBrowser;

@Test
public void AjaxAutoSuggests()
 {
    oBrowser = new FirefoxDriver();

    oBrowser.get("https://www.gmail.com/intl/en/mail/help/about.html");

     oBrowser.findElement(By.id("gmail-create-account")).click();

    oBrowser.findElement(By.id("GmailAddress")).click();

    String sText = oBrowser.findElement(By.id("gmail-address-infomessage")).getText();
    System.out.println(sText);      

  }

}

This code does not successfully capture the pop-up message.

If anyone could take a look at this code and provide ideas on how to accomplish this, I would greatly appreciate it.

Thank you in advance!

Answer №1

here is an example:

String textValue = webBrowser.findElement(By.cssSelector("div.popup")).getText();

it's successful for me

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

Mastering Mockito for mocking org.openqa.selenium.support.ui.Select components

Unit testing is a vital part of my Selenium integration tests, and in order to effectively test them, I need the ability to mock the selenium Select Object. The method I am testing: protected int findOptionByIgnoreCaseText(String value, Select dropDown) ...

The if condition in Kantu is throwing an error due to an invalid token being

Recently, I decided to give the Kantu web automation tool a try for the first time. While most of it seems straightforward, I've come across an issue when trying to loop through a CSV file. Here's the relevant section of my script: { "Comm ...

Utilizing Node.js for Gmail API: Extracting Inline/Embedded Images

When working with email data, one approach is to use the gmail.users.messages.get() method. After fetching the email data, there are two functions used to handle the payload. function getBody(message) { var encodedBody = ''; try{ i ...

When attempting to run tests with Chromedriver and Maven, a java.lang.NoSuchMethodError occurs with com.google.common.collect.ImmutableMap

Just starting out with selenium tests and currently following some tutorials on maven via YouTube. Today, I experimented with a few codes which worked fine until I encountered an "Access Denied" message while trying to search for a product on a store page ...

Is it possible for Webdriver to match the speed of Selenium IDE?

I have been working on a unique test runner that allows me to run Selenium tests in TeamCity. One of the latest features I added is the ability to create tests in the IDE and save them in HTML format, which can then be executed by the test runner using Pyt ...

The wait.to_be_clickable() method in Selenium does not allow for immediate clicking

Currently, I am in the process of creating a test script to automate button clicks on dynamically inserted elements using ajax. However, I encountered an issue where after utilizing the wait.element_to_be_clickable method, the final element was not able to ...

Discover the job specifications pages on Dice.Com by utilizing C programming language

I have taken on a student project involving web scraping job postings from Dice.Com for analysis. My main focus is on extracting the job description, but I am struggling to figure out how to access it. With limited knowledge in HTML and C#, I find it dif ...

Using Selenium in Python to automatically log in when a popup authentication window appears

Here's a snippet of code I've been working on: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.alert import Alert from selenium.webdriver.support.ui import WebDriverWait from selenium ...

Accessing a website and retrieving a document with Python

I am seeking assistance in improving the following script to successfully click on the export button. Although the script navigates to the report's page, it does not actually interact with the export button: from selenium import webdriver options = ...

The class is experiencing an undefined method error while attempting to extend a Java class using Selenium

I am just starting out with selenium and java and struggling to create a program due to various issues. Below is the code snippet for the Parent Class. Error encountered in the Login Method. Received an error stating "Void is an valid type" along with ...

Upon clicking the button in Selenium, a blank page is generated

I have been attempting to populate a text box using Selenium, but I am encountering difficulty locating the text box after clicking on the button to add a new customer. Instead of displaying the expected content, it consistently shows a blank white page. ...

How to use PHP xpath to validate the presence of a specific style attribute and its

Seeking assistance with parsing HTML files/strings for specific values using PHP and XPath. <DIV STYLE="top:110px; left:1280px; width:88px" Class="S0">Aug30</DIV> I attempted to locate an unknown value (in this case: Aug30) with knowledge of ...

Extracting Booking.com's Availability Information through Web Scraping

I'm currently trying to extract availability information from booking.com but I've encountered an issue when trying to click and open the dates tab. Despite my efforts, I can't figure out why I keep getting an error. Below is the code snipp ...

Assistance needed with regular expressions for the third div element

Currently, I am working with an xpath that looks like /html/body/div/div[2]/form/div[3]/p/a[2]/strong. When the part div[3] changes to values such as div[4], div[5], div[6], and so on, I find it challenging. Can someone offer guidance on how to handle the ...

Exploring the compatibility of IE9 with Selenium WebDriver

Hey everyone, I'm attempting to automate tasks in IE9 using Selenium WebDriver but keep encountering the following error in my Eclipse log. Can anyone offer some assistance? Internet Explorer is selected Started InternetExplorerDriver server (32-bit) ...

What is the best way to locate common data between two lists?

My current situation involves working with two lists that contain web elements. List<WebElement> assert_number= driver.findElements(By.xpath("//div[@class='tabs__body-inner']")) ; assert_number: This list includes multiple brand ...

Trigger an Onclick Event in Selenium

I am attempting to click on a menu icon with the following HTML code <a href="#" class="ctm-icon-link" onclick="show_menu('doc_107094', 1); return false;"><i class="icon-left-space icon-chevron-sign-down">&nbsp;</i></a& ...

Experimenting with Selenium Webdriver to locate an input element by its name and input a specific value

I'm having trouble inputting a value in the final box. (Chassis Number) Here's what I've attempted: python from selenium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by imp ...

I'm curious to know the Ruby equivalent of Selenium's elementToBeClickable compared to Java

As I delve into Ruby scripting for automation frameworks, I've been exploring the combination of Selenium and Ruby. One issue I've encountered is the absence of the elementToBeClickable method in Ruby Selenium. In a script where I attempt to clic ...

Are you familiar with textbox interactions?

I have been utilizing Kantu to automate the process of completing various forms. One particular textbox is designed in such a way that when an individual's ID number is input and you click into another field or tab out of the box, it automatically loa ...