Unable to select dropdown menu on Safari browser using MacBook Pro

I am just starting out with automation and I'm having trouble clicking on a dropdown in my application using Safari Browser. The script keeps failing with an error message. Can someone please assist me?

Error :

An unexpected server-side error occurred while executing the command. (WARNING: No detailed stacktrace is available)
Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DHRODCLPC0316', ip: '2409:4042:2098:9614:d857:22cd:8ec8:8ceb%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '13.0.2'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities {applicationCacheEnabled: true, browserName: safari, cleanSession: true, cssSelectorsEnabled: true, databaseEnabled: true, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: false, nativeEvents: true, platform: MAC, platformName: MAC, rotatable: false, version: 13605.3.8, webStorageEnabled: true}
Session ID: C7B2C752-80D4-4453-B0C7-C35151B11F3C

Configuration :

  • Safari Version 13
  • Macbook Pro machine

Code Flow:

  1. Open URL
  2. Login with credentials
  3. Click on Quick order
  4. Enter few codes to add in cart
  5. Verify prices and checkout
  6. Select shipping address from dropdown

SCRIPT :

package lbs.leica;


import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class Testcase_240_UAT_SAFARI extends  ExtentReport_UAT
{
    WebDriver driver;

    public static String cardNumber = "4111-1111-1111-1111";
    public static String Expiry = "01/29";

    @BeforeTest
    public void initialization() 
    {
        test = extent.createTest("Order tests in UAT plethora of different order tests to verify tax, shipping, customer pricing, list pricing");

         driver = new SafariDriver();

         driver.manage().window().maximize();
         driver.manage().deleteAllCookies();
         driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
         driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
         driver.manage().window().maximize();
         driver.navigate().to("https://shop-lbs.mediatis.de");   
         System.out.println(driver.getTitle());

         reportLog(driver.getTitle());

    }

    @Test
    public void VerifyPrices() throws IOException, InterruptedException 
    {
            driver.findElement(By.xpath("//*[@id='login-menu_login_title']")).click();
            Thread.sleep(2000);
            driver.findElement(By.xpath("(//*[@id='ShopLoginForm_Login'])[2]")).clear();
            driver.findElement(By.xpath("(//*[@id='ShopLoginForm_Login'])[2]")).sendKeys("<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="680e021b0105280a1d0e0e090407460d0c1d">[email protected]</a>");
            Thread.sleep(2000);
            driver.findElement(By.xpath("(//*[@id='ShopLoginForm_Password'])[2]")).sendKeys("!InterShop00!");

            reportLog("Entered username and password");

            // Click on login in button
            driver.findElement(By.xpath("(//*[@class='account-sign-in btn btn-primary'])[2]")).click();
            Thread.sleep(5000);

            reportLog("Clicked on Login ");


            driver.findElement(By.xpath("//*[@class='view-account']")).click();
            Thread.sleep(5000);

            // Click on Quick Order
            driver.findElement(By.xpath("//*[@class='quickorder-li hidden-xs']")).click();
            Thread.sleep(5000);

            reportLog("Clicked on Quick Order ");


            // Click on Copy and paste
            driver.findElement(By.xpath("(//*[text()='Copy and paste'])[1]")).click();
            Thread.sleep(4000);

            reportLog("Clicked on Copy and paste ");


            //Enter Codes in text box
            String[] voucherCodes = {"DS9800 1", "PA0515 2", "AR0222 3", "PA0027 4", "PA0571 5", "PA0813 6", "3801800 1", "3803650 1", "3800680 1", "3801815 1", "3800675 1", "3800080 1", "3800050CL 1", "3800161 1"};
            WebElement input = driver.findElement(By.id("addToCartCopyAndPaste_textArea"));
            for (String voucher : voucherCodes) 
            {
                input.sendKeys(voucher+"\n");
            }

            reportLog("Entered Codes ");


            //Click on Add to cart
            driver.findElement(By.id("addToCartCopyAndPaste")).click();
            Thread.sleep(9000);

            reportLog("Clicked on Add to cart ");
           
           // Other code omitted for brevity...

            reportLog("Selected first address ");

Answer №1

"Oops! Something went wrong on the server side while trying to process your request."

This error could suggest a problem with safaridriver. To get a better idea of what's happening, consider adding the 'safari:diagnose' capability to New Session. By doing this, safaridriver will log protocol traffic to ~/Library/Logs/com.apple.WebDriver//. For more details on how to enable diagnostics, check out man safaridriver.

If the protocol trace indicates that a command is failing unexpectedly (such as an HTTP 500 error), please submit an issue at so Apple can investigate it further. Providing a simple test case can greatly assist in resolving the problem, so be sure to include one!

Thank you!

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 technique for scrolling multiple times to locate a specific element?

I am trying to develop a script that will continuously scroll until it finds the specific element using: from appium.webdriver.common.touch_action import TouchAction The webpage in question is an Events page featuring various game titles. Currently, I ha ...

How can I manage excessive amounts of data in a single line and prevent overwhelming the system?

The title may be a bit confusing, but what I am trying to convey is: InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; JSONArray ja = new JSONArray(); wh ...

What could be causing my XPath locator to not function properly?

While trying to locate this element driver.get("https://ivtripadmindev.azurewebsites.net/login"); driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div/div/div/div[2]/form/div[1]/input")).sendKeys("5"); Encountering the following Exception e ...

The class 'SelectElement' is missing a constructor that accepts one parameter in ToolsQA

using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using Sys ...

What is the process for creating an xpath for hyperlinks with the 'contains text' attribute?

I am in need of creating Xpath for links based on contained text. I have devised the following code to achieve this, however, a scenario arises when there are three links named 'Entity', 'Entity Type', and 'Entity Group'. If I ...

When Selenium in JavaScript cannot locate a button element, use `console.log("text")` instead

I am trying to capture the error when there is no button element available by using console.log("No element"). However, my code is not working as expected. const {Builder, By} = require("selenium-webdriver"); let driver = new Builder().forBrowser("chrome ...

Implementing @BeforeSuite to run after setting up the webdriver instance in Arquillian

I am facing an issue with using @BeforeSuite after the instantiation of WebDriver in Arquillian. Below is an example: @RunAsClient public class GoogleTest extends Arquillian { @Drone private WebDriver driver; @ArquillianResource private ...

Our job site Selenium webscraper encounters a glitch at a particular step during its operation. How can this be resolved and pinpointed the root of the issue?

Several months ago, I created a web scraper to track job listings for a football club. Everything was running smoothly until about a week ago when the program started experiencing multiple issues. Despite my efforts to troubleshoot and make changes to the ...

Tips for identifying the existence of an element using Selenium WebDriver in Java

When attempting to use Selenium WebDriver's findElement() function to check for the presence of an element on a page, I encounter issues where Selenium exits the code even when handling exceptions with WebDriverException. Although I tried implementin ...

Python Selenium Error - Message: Element not found: Element could not be located

Currently facing an issue while trying to extract data from a password-protected website using Selenium. The error occurs right at the login stage with the following message: NoSuchElementException: Message: no such element: Unable to locate element: {"met ...

Issue with watir webdriver script not running successfully in Jenkins platform

I recently set up Jenkins on my local machine and now I want to run a watir webdriver script in Jenkins that is currently running successfully through the command prompt. Below is the basic watir script: require 'watir-webdriver' b=Watir::Browse ...

When conducting tests with the Page Factory Design and Page Object Model, two browser instances are launched using Selenium and Java

I am facing an issue with my Selenium WebDriver test using the Page Object Model. When I run the test, it opens two windows in the Chrome browser, with the first window being empty in the URL bar. How can I make it open only one window with the onet.pl URL ...

Pause before running a command (Selenium WebDriver)

Working with Java in Eclipse using Selenium WebDriver, I am looking for a way to wait for a command to be successfully executed without specifying a specific amount of time like Thread.sleep(). Ideally, I want the command to be executed immediately after ...

Is it permissible to generate data in PDF format directly from the frontend?

Within my application, there exists a search form that produces paginated results in the back-end. Occasionally, searches yield thousands of results. A new feature request has been made to allow for exporting search results in PDF format. I am wondering ...

Using ChromeOptions to Manage Webdriver Execution

I encountered a problem in Chrome where I received an error message "You Are Using An Unsupported Command-Line Flag –Ignore-Certificate-Errors. Stability And Security Will Suffer." when running my Selenium code as shown below. Public Sub key() Dim sel ...

Detecting element changes with Selenium and Python

My concept involves developing a bot that can analyze messages in a chat, all of which are displayed within a ul>li structure: <ul class="message-list"> <li class="message"> Hey there! </li> <li class="message"> Hi! ...

Is there a way to automate the process of navigating through multiple pages in order to extract and download Excel files using

I am currently developing a web scraping tool that is designed to navigate through website pages in order to extract Excel files from a dropdown menu located at the bottom of each page. Unfortunately, the webpages only allow me to download the 50 location ...

Upon running the Python Selenium script, Google Chrome will shut down automatically

I was testing this code and noticed that it runs without any errors, but for some reason it automatically closes Google Chrome after searching for w3schools. from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdri ...

The issue of JMeter WebDriver failing to recognize variable values

I'm currently facing some confusion while using JMeter with Selenium. My scenario involves having two Webdriver Samplers for different pages and a JSR223 Sampler to set up data, such as vars.put("loanAmount", "50000"); and other variables. Interesti ...

The functions in Webdriverbackedselenium are unable to interact with selenium commands

In my code, there is a method named test which consists of defining a Webdriver object as shown below: FirefoxProfile firefoxprofile = new FirefoxProfile(); firefoxprofile.setAssumeUntrustedCertificateIssuer(false); WebDriver driver = new FirefoxDriver(fi ...