Having trouble preventing Selenium webdriver from automatically closing the safari browser

Experiencing a strange issue with Safari where it closes the browser immediately after running the code snippet below, while Chrome and Firefox behave as expected. I am using Webdriver with JavaScript for this automation.

    let driver = await new Builder().forBrowser("safari").build();
    await driver.get("http://website.com");
    await driver.findElement(By.name("os_username")).sendKeys("username");
    await driver.findElement(By.name("os_password")).sendKeys("password");
    await driver.findElement(By.name("login")).sendKeys(Key.RETURN);

    // Enter search bar data and press return.
    await driver.sleep(5000);
    await driver.findElement(By.name("searchString")).sendKeys("Name");
    await driver.findElement(By.name("searchString")).sendKeys(Key.RETURN);
    await driver.sleep(10000);
}
safariLogin(); 

Answer №1

To avoid the script from terminating, simply insert a breakpoint at the conclusion.

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 process for transferring a file's contents to my server?

I am currently working on allowing users to import an OPML file that I parse server-side in my Rails application. However, I am facing difficulties as it appears that my server is not receiving the information correctly (neither the success nor error funct ...

The hyperlink does not function properly when included within an <input type=button> element

I have encountered an issue with the code below. In my project, I have a search bar along with some buttons. Currently, only the hyperlink of the search button is functioning correctly. The other buttons seem to redirect to the same link as the search bu ...

Result array, employed as an input for auto-suggest functionality

I’m currently working with an array where I am iterating over an object from an API endpoint that is in stdClass format: foreach($searchResults->hits as $arr){ foreach ($arr as $obj) { $fullType = $obj->_source->categories; print_r($fu ...

JavaScript retrieve data from an external JavaScript file

How can I retrieve the id value from my rendering.js file? <script type="text/javascript" src="./js/rendering.js?id=3"> I am trying to access the id value in my rendering.js script. Any suggestions on how to accomplish this? ...

The functionality does not seem to be functioning in Mozilla Firefox, however it is working correctly in Chrome when the following code is executed: `$('input[data-type="choise"

I am currently working on an online test portal and everything is functioning properly with Chrome. However, I am encountering an issue with Mozilla Firefox. My code works fine in Chrome but not in Mozilla Firefox. Please suggest an alternative solution to ...

The Ajax operation does not finish before the second one is initiated

My Ajax function is set up like this: function PersonAtlLawUpdate(personRef) { var selectionPanel = $('div#SelectionPanel'); var fromdate = selectionPanel.find('input#FromDateTextBox')[0].defaultValue; var timeSpan = selectionPanel.fin ...

Unable to retrieve information using the post method in Express framework

After creating a basic code to fetch data from the client, I am facing an issue where req.body.firstname is showing as undefined. Here is the code snippet: const express = require('express'); const app = express(); const body ...

Has there been an update in the way unhandled alerts are managed by ChromeDriver and Chrome when using Selenium?

For several months, my test has been running smoothly. One of its functions is to trigger an alert and then verify the text of that alert. The test is executed using Selenium, Java, and Chrome Driver 76.0.3809.68. However, recently I've encountered a ...

Automatically updating a database value in CodeIgniter after a countdown has expired

I am looking to automatically update a value in my MySQL database using CodeIgniter once a countdown timer reaches zero. However, I am struggling to figure out how to implement this. Here is an example: I have a database structured like this: [image lin ...

Ensure $q.all does not produce an error when one promise is not resolved

While geocoding addresses, there are instances where some fail. My goal is to retrieve the successful results and disregard the failed ones in order to display the coordinates on a map. Currently, using $q.all triggers the errorHandler when one promise i ...

What is the best way to store a username and password within a JavaScript object in ReactJS?

I am encountering an issue with obtaining the login credentials from the object. Although the code snippet below functions perfectly well with other forms. SignIn.js export default function SignIn(props) { const [state, setState] = useState({ userna ...

The planebuffergeometry does not fall within the three namespace

I am currently working on a project using three.js and next.js, but I keep encountering this error: 'planeBufferGeometry is not part of the THREE namespace. Did you forget to extend? See: As a beginner in three.js, I'm unsure what exactly is ca ...

Learn how to smooth out a path in d3.js before removing it during the exit transition

Description: My interactive multiple line chart allows users to filter which lines are displayed, resulting in lines entering and exiting dynamically. Desired effect: I aim to smoothly transition a line to align perfectly with the x-axis before it disappe ...

Instructions on choosing a specific row within a data table using Selenium

1. I am working on a User Registration page where I need to select newly registered users from a data table as an admin. 2. Depending on the user roles, they should be positioned anywhere within the data grid. 3. I also need the ability to select a specifi ...

Ways to verify the presence of an item in a MonoDB array

My MongoDB model looks like this: const userSchema = new Schema = ({ name: { type: String }, company: [ companyId: { type: String, }, movies: [ { genre: { type: String, enum: [ ...

`What is the best way to employ the Return statement in programming?`

Trying to grasp the concepts of functions and methods has been a challenge for me. I often find myself confused about when, where, and how to use return statements in different situations. To illustrate this confusion, let's take a look at two code sn ...

Difficulty with info window within a for loop

I am currently working on implementing multiple info windows for markers. I found an example on Stack Overflow that I am trying to follow. Despite not encountering any errors in the console, the info windows do not appear as expected when clicking on the m ...

Is Local Storage compatible with phonegap?

I am looking to integrate local storage into my phonegap application in order to store an array of data. Here is a snippet of my code: <div data-role="collapsibleset"> <div data-role="collapsible"> <h3>LOG ...

Chrome Automation Tool for Selenium

Currently encountering an issue with the Chrome driver in Automation Testing. Whenever I run the code, it prompts the following messages and subsequently closes my page. SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger i ...

Utilizing D3.js: Applying Multiple Classes with Functions

My current project involves using D3.js and I've encountered a particular challenge that has me stumped. In the CSV file I'm working with, there are columns labeled "Set" and "Year". My goal is to extract values from these columns and use them a ...