"Selenium throws a 'Connection refused' error after attempting to interact with an

To keep it brief, I'm facing an issue while trying to automate this survey on the website:

The problem arises when I attempt to click the 'Sélectionnez votre réponse' button using the webdriver, leading to multiple errors:

  1. ConnectionRefusedError: [Errno 61] Connection refused
  2. urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fe51e4a5d90>: Failed to establish a new connection: [Errno 61] Connection refused
  3. urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=61616): Max retries exceeded with url: /session/84d1bcb3f29dcea5ebc17515f7006576/element (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe51e4a5d90>: Failed to establish a new connection: [Errno 61] Connection refused'))

In an attempt to address this issue, I've tried manipulating the hidden tab as follows:

Given the HTML structure:

<div aria-describedby="Select_0_placeholder" aria-expanded="false" aria-label="Sélectionnez votre réponse" class="office-form-question-dropdown [the rest is not important]

I experimented with changing the value of aria-expanded through JavaScript to reveal the hidden tab. Here's the script I used:

driver.execute_script("document.getElementById('Select_0').aria-expanded = true ;");

Unfortunately, this resulted in the following error: "javascript error: Invalid left-hand side in assignment"

I'm struggling to find a solution to this recurrent issue and unsure if resolving it will also fix the 'connection refused' problem I encounter while clicking on the element.

Your assistance in solving this puzzle would be greatly appreciated. Thank you!

Answer №1

Click on the select_0_placeholder and then select the first li tag. It's unclear what you want to be selected.

driver.get("https://forms.office.com/Pages/ResponsePage.aspx?id=J_MxGtETnkCJtoTI3pL1UnkYW0ynf4dLv0B_tcadw1NUNklaWkJPSjk2WEM0UTBBS1FIS1MwU05LQy4u")
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@aria-label='Next']"))).click()
wait.until(EC.element_to_be_clickable((By.ID, "Select_0_placeholder"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//ul[@class='select-option-menu-container']/li[1]"))).click()

Import

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC

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

Interacting with data entry on the webpage using Vue.js

In a data input page, I encounter the need for various actions when specific data is entered. Currently, I handle data manipulation by sending back changes to the server and refreshing the screen. The application operates on an internal network for product ...

The importance of a well-organized framework for functional and acceptance tests

Currently working on developing an automated functional/acceptance test suite for a project. Although I lack experience in writing these types of tests, I am seeking advice on how to structure them properly, particularly while using Arquillian's Graph ...

Using Vanilla CSS with React?

This is my first time working on a react app and I'm a bit unsure of the best approach to styling components. Currently, I am creating a separate .css file for each component or page, and including it implicitly. While this method seems the simplest, ...

The CORS policy has blocked access to the API at 'https://test.secure.app/api' from the origin 'http://localhost:3000'

import React, { useState, useEffect } from 'react' import axios from 'axios' const Test = () => { const [data, setData] = useState() useEffect(() => { const fetchData = async () => { const url = 'https://tes ...

What could be causing the issue with my dynamic sitemap.xml file not functioning properly?

I have encountered an issue with creating a dynamic sitemap in my Next.js app. Despite following the instructions in the Next.js documentation and placing a sitemap.js file inside my app directory, I am seeing a 404 error when trying to access http://local ...

The isInvalid property fails to apply red highlighting to the input box in a react-bootstrap form

Working on creating forms using React and react-bootstrap. Currently, my form includes an email field structured like this - https://i.sstatic.net/dlbWn.png Here's the code snippet of how it looks: <Form noValidate autoComplete="off&quo ...

What is the process of incorporating a select form within a component?

I am currently working on creating a user registration form. Once the form is filled out and the submit button is clicked, I need the values from the form to be displayed in a specific <p id="data></p> component. Can anyone assist me with this ...

Choose or deselect images from a selection

I am currently working on a feature for an album creation tool where users can select photos from a pool of images and assign them to a specific folder. However, I'm facing difficulty in selecting individual photos and applying customized attributes t ...

Unveiling the steps to seamlessly publish JSON data from a URL to Pubnub

i have retrieved some JSON data from this specific URL how can i publish this information to Pubnub? i've prepared a real-time Graph using a code snippet, but the input is static. I aim to dynamically fetch data from a URL <html> <head> ...

Using AngularJS to integrate Highcharts with live updating data fetched via AJAX

Currently, I am in the process of learning Javascript and AngularJS through a combination of two examples: Spring MVC and AngularJS as well as AngularJS and Highcharts. One particular aspect that has been quite challenging for me involves integrating the ...

Guide on serving static HTML files using vanilla JavaScript and incorporating submodules

Is it possible to serve a static html file with elements defined in a javascript file using imports from submodules using vanilla JS? Or do I need bundling tools and/or other frameworks for this task? Here's an example code structure to showcase what ...

Circular dependency in Typescript/Javascript: Attempting to extend a class with an undefined value will result in an error,

Query Greetings, encountering an issue with the code snippet below: TypeError: Super constructor null of SecondChild is not a constructor at new SecondChild (<anonymous>:8:19) at <anonymous>:49:13 at dn (<anonymous>:16:5449) ...

Tips for successfully integrating .dae files into three.js for online execution on a web browser

Hey everyone, I'm an HTML developer who has never worked with WEBGL technology before. I've been trying to figure out how to pass a .dae file into 'three.js' by searching through numerous websites, but I haven't been successful. C ...

Looking for assistance with implementing JavaScript to trigger a button click when hovering over a map tooltip

I recently created a map using a WordPress plugin that displays tooltip popups when you click on icons. You can view the map here: My goal is to have the tooltips appear when hovering over each icon, but currently, the tooltips disappear when trying to mo ...

What is the best way to store this value in a variable and incorporate it into a conditional statement within a React application?

Seeking assistance in resolving this issue. I am trying to extract the values between the backticks (``) from the span tag and store them in a variable for the logic shown below: ${research.data.codesRelated[1].code} === undefined ? ${research.data.desc ...

Using Alpine JS to rotate through images at regular intervals using the window.setInterval() method

Attempting to tackle a simple task using Alpine JS and the standard JS function setInterval. The goal is to create an image selector where images switch every second (1000ms). Here's what I have so far: <div x-data="imgFunc()"> ...

What is the most efficient method for managing the save form process (insertion vs updating) using AJAX?

I have been exploring various methods to manage the insert and update processes in my front-end forms efficiently. There are two distinct scenarios that I need to address: one where users input new data and save that record, and another where they update a ...

Python's Selenium library has encountered difficulty in scrolling downward

Is there a way to automatically scroll all the way down to load more products on a webpage using selenium-webdriver in Python? driver = webdriver.Firefox() driver.get('https://www.woolworths.com.au/Shop/Browse/back-to-school/free-school-labels') ...

What steps do I need to follow in order to create an AJAX application that functions similarly to node

As someone new to ajax, I am facing challenges while trying to create a forum software similar to nodebb. Despite having developed a php forum previously, its outdated appearance prompted me to seek alternatives like nodebb for a more modern look and feel. ...

What is the method for programming a Discord bot to respond to your messages?

As a beginner in coding, I have been working on creating a bot that can respond with whatever is said after the command !say. For example - if you type !say hello, the bot will reply with "hello". This is what I have attempted: let args = message.content ...