Keystrokes malfunctioning on Firefox while functioning correctly on Chrome

I am currently in the process of developing a web scraping application using Python and Selenium to automate tasks on a server. Specifically, I am looking to create and schedule posts through CreatorStudio for sharing on Instagram. However, I have encountered an issue with sending emojis using the send_keys method in browsers like Chrome and Edge Chromium. Despite this limitation, I have found that Firefox is able to send emojis successfully. Unfortunately, using a copy-paste workaround is not feasible due to running the application on a server. It's worth noting that while send_keys functions properly on Firefox for certain web elements like input fields (e.g., Google search bar), it fails when attempting to target specific elements like

driver.find_element_by_xpath("//div[@class = '_1mf _1mj']")
. This discrepancy between browser behavior poses a challenge as this functionality works in Chrome but not in Firefox.

Are there any potential solutions to address this compatibility issue? Perhaps there is a workaround or JavaScript code that can be implemented?

Thank you

Answer №1

One approach is to generate the element xpath utilizing an input tag. Alternatively, you have the option to utilize JavaScript Executor or Action class for key input.

To illustrate with code: JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("document.getElementById('elementID').setAttribute('value', 'new value for element')");

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

Is there a way to retrieve this data from a webpage using Python, Selenium, and ChromeDriver?

<div class="flexible row ng-scope"> <!-- ngRepeat: graph in graphs track by $index --><figure class="figure-gauge flexible column ng-scope" data-ng-repeat="graph in graphs track by $index"> <figcaption class="rigid"> ...

Steps for executing a single test case via Jenkins

Currently, I have a testng suite with 10 test cases and I am looking to execute individual test cases from Jenkins. Can anyone provide guidance on how to do this? I attempted to use Maven Surefire commands by including the test case in the goals and execut ...

Python Selenium Webdriver Click Method Not Functioning Properly

I'm currently working on the integration of my Wegmans account with a spreadsheet through Selenium and chromedriver in Docker. However, I am encountering an issue where clicking the next button on the login/sign-in page does not produce any effect on ...

What exactly is the significance of the "contains(., 'some text')" function when utilizing XPath in Selenium?

As someone who is just beginning with selenium coding, I've noticed a few xpaths that include (.,'followed by something'). Can you clarify what the . refers to in this context? ...

Selenium with Python can be used to perform right-click actions on web

I am currently having difficulty in figuring out the correct way to execute a right click. Below is an example of my code: click_Menu = driver.find_element_by_id("Menu") print(click_Menu.text) action.move_to_element(click_Menu) action.context_cl ...

Could you assist me in storing the current URL as a variable?

As a newcomer to Selenium IDE, I am still learning the ropes of scripting and coding. My goal is to capture the URL of the current page as a variable for future use. Most of my research has led me to outdated information about the storeLocation command, w ...

Assessing the level of code coverage for Selenium tests located in individual projects

I currently have two distinct Java Maven projects - one for my web application itself, and the other for Tellurium+Selenium automation tests for my web app. I decided to separate these test projects due to their code being unrelated to the web app project ...

Autoit script fails to run in Chrome web browser

Here is the code snippet for uploading files using Firefox (.au3 file): ControlFocus("File Upload","","Edit1") ControlSetText("File Upload","","Edit1","C:\Users\chaithu\Desktop\fileupload.html") ControlClick("File Upload","","Button1") ...

How can I determine the specific quantity of XPATH links with unique identifiers in Selenium?

Seeking automation with Python3 and selenium to streamline searches on a public information site. The process involves entering a person's name, selecting the desired spelling (with or without accents), navigating through a list of lawsuits, and acces ...

Creating an HTML table for displaying a summary of test execution results in the body of an email using Outlook

Context: Within our project, which is based on selenium-cucumber-java-Mvn, we utilize the master thoughts Cucumber report (mvn dependency) for test execution reporting. This report is generated in the test>target directory and the link to this folder is a ...

What steps do I need to take to configure Eclipse and Selenium to execute scripts on different browsers on a Mac computer?

Being new to Macs, I am encountering difficulties running scripts on browsers like IE or Chrome. Here is the progress I have made so far: Updated Eclipse, Selenium standalone server, and Selenium IDE Set up TestNG framework in Eclipse Installed Selenium ...

Issue with combining overflow-x, Firefox, and JavaScript

In Firefox, an issue arises that does not occur in other browsers. To see the problem in action, please visit this example page: -removed- Try selecting a page other than the home page. The window will scroll to your selection. You can then scroll down u ...

Receive a promise from an assertion within the 'then' block

Attempting to create a sequence of selenium commands using 'then' has left me stumped on how to return a promise from asserts. The warning message I keep encountering is as follows: (node:18772) UnhandledPromiseRejectionWarning: Unhandled promise ...

Initiate a react change event using Appium

I'm currently working on automating a hybrid app that has a login screen implemented as a react web view, and unfortunately, I don't have control over it. The challenge I'm facing is that the Sign-in button remains disabled until something i ...

Guide to downloading a file using Python, Selenium, and PhantomJS

I am currently facing a challenge where I need to login to a website and download a CSV file from a Linux server in a headless manner. The webpage utilizes JavaScript and is dependent on it for functionality. After conducting some research, I decided to u ...

Dividing an ArrayList of strings into various subparts and storing them in a HashMap: programming in Java with the help of Selenium

Here is a breakdown of the passenger list: 1: Adult(s) ‎(1 X 9,288)‎ 2: Child(s) ‎(1 X 9,288)‎ 3: Infant(s) ‎(1 X 2,429)‎ 4: Adult(s) ‎(1 X2,712)‎ 5: Child(s) ‎(1 X 2,712)‎ 6: Infant(s) ‎(1 X 146) I am trying to extract i ...

Attempting to scan through each Reddit headline in order to make a decision on which one to click

I have been attempting to extract the titles of each post in text format, but I've had no luck so far. Each title is enclosed within an h3 tag and my previous approach using this tag has not been successful. Below is the code snippet that I have deve ...

Extract information from a table where the elements take some time to fully load into view

My latest project involves scraping data from a table using selenium. Unfortunately, every time I run the code, it only manages to retrieve the header of the table. from selenium import webdriver driver = webdriver.Chrome() driver.get('http://www.pa ...

Guide to capturing the name H MATTHEWS from a website's HTML using Selenium with Python

When utilizing the 'contains' function, how can I extract specific information from this particular HTML structure? My goal is to gather the name "H MATTHEWS". HTML: <p> <strong>Date Published:</strong> &nbsp; 20 APRIL 2020 ...

Access to the org package is restricted in Selenium web driver

Encountering an issue while trying to write a Selenium code in Java - receiving an error that 'package org is not accessible'. I have downloaded the Firefox driver and provided the correct path. Any guidance would be greatly appreciated. Please ...