Selenium: What causes the CSS selector to fail in IE10 while working fine in Firefox and Chrome?

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


wait = WebDriverWait(webdriver, 10)
elem = wait.until(EC.visibility_of_element_located(
            (By.CSS_SELECTOR, '.top_layer.active-element')))

The code snippet above is functioning properly in Firefox and Chrome browsers. However, an issue arises when attempting to use it in Internet Explorer, resulting in the following error message:

 Unable to find element with css selector == .top_layer.active-element (WARNING: The 
 server did not provide any stacktrace information) Command duration or timeout:  
316 milliseconds For documentation on this error, please visit:  
http://seleniumhq.org/exceptions/no_such_element.html Build info: version:  
'2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33' System info: host: 
 '172-16-4-157', ip: '172.16.4.157', os.name: 'windows', os.arch: 'x86',  
os.version: '6.2', java.version: '1.8.0_40' Driver info:  
org.openqa.selenium.ie.InternetExplorerDriver

Is there a way to adjust the CSS selector so that it functions correctly in IE10 as well?

Answer №1

To improve performance, consider turning off native events in the IE driver. For a complete list of IE capabilities, visit this link

self.profile = webdriver.DesiredCapabilities.INTERNETEXPLORER
self.profile['nativeEvents'] = False
self.driver = webdriver.Ie(self.profile)

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 it possible to attach a CSS file specifically to just one React component?

Is there a way to restrict the CSS styling in my Home.js component so that it does not affect any other components? I have a separate CSS file for each component, but when I apply the styling from one file to Home.js, it ends up affecting everything else ...

Understanding the concept of for loops in JavaScript and incorporating them in CSS styling

Hello there! I initially used this code to draw 12 lines, but now I am looking to incorporate a for loop and implement it in CSS. Can someone please guide me on how to proceed? <!DOCTYPE html> <html> <head> <style> #straigh ...

Turbolinks not allowing the addition of JavaScript classes for background images

While trying to merge a front end html theme with my Laravel app, I encountered an issue with turbolinks that is preventing Javascript from appending div classes. This is resulting in background images only being displayed on page refresh. <div class= ...

Is it necessary for a method to be async if browser.wait is used within it?

Just starting out with typescript, so go easy on me. I'm currently refactoring some selenium tests using protractor and angular. I've created a method to wrap browser.wait(ExpectedConditions.presenceOf(element)); My tests were passing fine wh ...

Guide to creating an inline form that spans the entire width below the navbar logo within the "navbar" component

I'm new to working with bootstrap and trying to create an inline form in the navbar next to the navbar-brand. However, as I resize the window, the form ends up below the navbar-brand link and doesn't align properly, making it look awkward. Can so ...

Ways to confirm the tag of a web element once it has been retrieved using XPath

Currently, I am utilizing Selenium with Python along with Chrome driver. The situation at hand is as follows: On a webpage, I am extracting all elements that have either id==customer_info or class==prize_info by employing the subsequent code: customer_or ...

Creating Static Content using Spring Framework

I need some help with handling static content in my SpringMVC app. Currently, I am using the following configuration: <mvc:resources mapping="/resources/**" location="/resources/" /> This setup works well for uploading and retrieving images within ...

Ways to prevent a div containing a lengthy content string from extending beyond other divs

Check out my Codepen project here Here is the HTML code for my personal website: <div id="splash" class="divider"> <h1 class="text-center text-uppercase">vincent/rodomista</h1> <p class="text-center text uppercase">Full Stack ...

Issues arise when setting a delay for CSS transitions to occur due to the

I'm trying to create a scroll bar that only appears when hovered over, similar to how it works on Facebook where the scroll bar shows up slowly instead of all at once. I've tried using CSS transition delay, but it doesn't seem to be working ...

Using Python with Selenium to access the ancestor element of a span element

I am attempting to locate the first ancestor <tr> node from the <span> node. The <span> node is a child of a <div> which is also a child element of a <td>. I access the value of the <span> by searching for the element ...

Facing NoClassDefFoundError issue with Selenium and Maven

Using the dependency below worked without any issues: <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> ...

Designing a website's layout with HTML and CSS

I am having trouble developing a concept depicted in the image below. Here is what I have accomplished so far: https://jsfiddle.net/o0zmtr3q/2/. I am struggling to make each box unique, especially with the layout where the text is positioned differently in ...

Guide on creating an empty ArrayList in JSON using Rest Assured

When serializing the JSON from a POJO class, I encountered an issue where passing null or empty values to the properties in the POJO class resulted in getting [""] in the array list instead of []. Expected: "Key": [] But Received: "Key":[""] This is how ...

Importing usernames and passwords from a .txt file with Javascript

I'm in the process of creating a website that includes a login feature. The usernames and passwords are currently stored within the website files as .txt documents. I am aware that this method is not secure, but for the purpose of this project, I want ...

Delegating events with .on('click') and using the CSS negation selector :not()

Struggling to implement event delegation for a dynamically added or removed class? I need to create an event for elements that are clicked, but without a specific class. Here's the code I have so far, but it doesn't seem to be working. Could it b ...

Utilizing Selenium Grid in Conjunction with Page Object Model Page Factory

I am looking to optimize my browser initialization process for testing on multiple browsers using the Page Object Model Page Factory. Currently, I have the following setup in my Base Class: // initialize driver/browser public void initDriver() throws Ma ...

Using Python with Selenium to choose an option from a dropdown selection

I'm struggling to choose an item from a dropdown menu. Take, for instance: <div class="col-sm-4 col-lg-2"> <label for="rangeFilter" class="sr-only">Date Range</label> <select class="selectpicker" id="rangeFilter" data-none ...

Adjust the z-Index of the list item element

I am attempting to create an effect where, upon clicking an icon, its background (width and height) expands to 100% of the page. However, I am struggling with ensuring that the 'effect' goes underneath the this.element and above everything else. ...

Utilize jQuery to retrieve data attributes and set them as CSS properties in a key-value format

Looking at the HTML below: <h4 data-padding-top="100" data-padding-left="0" data-text-align="left" data-color="#ffffff">Promotion Two</h4> I aim to use the data attributes as CSS styles for the H4 element. I have attempted to achieve this ...

Having difficulty finding a modal element while web scraping with Selenium

I'm interested in visiting and exploring the "Topics" dropdown by clicking on "See All Topics," followed by selecting a random letter heading like "C" or "D-E." However, I'm struggling to locate the element within the modal popup that correspond ...