Uncovering intricate CSS selector techniques

I need help with filling text in a Selenium Firefox browser. I am struggling to find the selector for entering text and it seems very complex for me. Please explain the only way I can achieve this using only CSS selectors.

<div class="Gb WK">
 <div class="Rd"guidedhelpid="sharebox_editor">
<div class="eg">
     <div class="yw oo"">
<div class="yw vk"">
    </div>
    <div class="URaP8 Kf Pf b-K b-K-Xb">
      <div id="195" class="pq"
          Share what's new...
           </div>
           <div id=":37.f" class="df b-K b-K-Xb URaP8 editable"     contenteditable="true"
            g_editable="true"role="textbox"aria-labelledby="195"></div>
            </div>
           </div>
          </div>
         </div>

Answer №1

Although you have already written the cssSelector, allow me to provide an explanation for you. With CssSelector, you have the ability to conduct single or multiple attribute searches. If one attribute alone does not provide a unique result, you can simply add more attributes to the selector.

For single attribute searching:

[role='textbox'] 

For multiple attributes searching:

[role='textbox'][contenteditable='true']

If you prefer to include a div for a quicker search, that is also an option:

div[role='textbox'][contenteditable='true']

It is important to note that by omitting the div, the search will be independent of the HTML tag.

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

Conceal and reveal text with a simple user click

Currently, I am working on a website project that utilizes bootstrap. However, I am facing some uncertainty regarding how to effectively hide and display text: <nav class="navbar navbar-light" style="background-color: #e3f2fd;"> ...

Tips for avoiding detection of fake useragents in Selenium while running headless mode

Currently, my scraping bot is operating in headless mode. However, since it includes the term "headless" in the useragent when running as such, I decided to modify the useragent to circumvent this issue. Unfortunately, the website has detected this altered ...

Covering the full width of the page, the background image

My struggle is with setting a background image to 100% width, as the image ends up getting cut off on half of the screen. The picture becomes wider than my display area. How can I resolve this issue so that the image width adjusts to fit the screen without ...

Verify the pop-up browser window that appears when the page begins to reload using Cucumber

After completing one scenario, the page automatically refreshes. A JavaScript modal is displayed on the website asking the user "Are you sure you want to leave the page?" I need to confirm that modal, but every time I try to create a step for it, I encount ...

Design your HTML select element with a unique custom arrow where the text elegantly appears over the arrow

I've encountered an issue with a select element in my HTML page that has a custom arrow. The problem is that the text within the select element overlaps with the arrow, which is not desired. I'm seeking a cross-browser solution for this specific ...

Caution: [Unchecked] Be mindful of using unchecked method invocation when creating a custom Selenium ExpectedCondition

Attempting to develop a bespoke Selenium explicit wait using the code snippet below: class TabsOpened implements ExpectedCondition { int expectedTabs; public TabsOpened(int exp) { this.expectedTabs = exp; } @Override public Boolean apply(Obj ...

Utilizing CSS classes to style custom day templates in ng-bootstraps datepicker

Currently, I am utilizing ng-bootstraps datepicker to showcase user data on a daily basis. I have implemented a custom day template to apply specific CSS classes. <ng-template #customDay let-date> <div class="custom-day" [ngCla ...

When Bootstrap 4 teams up with Autoprefixer, it results in malfunctioning old iPads

.row { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin-right: -15px; margin-left: -15px; } Recently, we implemented Bootstrap 4 and the Flex model at my company. We'v ...

What is the best way to collapse additional submenus and perform a search within a menu?

Whenever a sub-menu is activated, only the current sub-menu should be open while the others remain closed. I need the search function to be enabled on the text box and display all items containing the specified value while also changing the color of <a ...

How can I effectively update Bootstrap 4 in a Rails environment?

After attempting to update my Rails 5 project from Bootstrap 4 Alpha 6 to the final version 4.0.0, I confirmed that the v4.0.0 gem was installed (with the alpha version gem uninstalled). However, upon running my project in development mode, I discovered th ...

Having trouble extracting tabular data using Selenium for web scraping, as the output is either an empty list or just the header

I've been attempting to scrape data from the page 'https://www.topuniversities.com/university-rankings/world-university-rankings/2022' in order to extract the table containing university rankings. Despite trying various methods such as findi ...

Steps for connecting a div to a collapsible navigation bar

I have a website with a collapsible navbar at the top for small screens. I want to add a red circle positioned on the right side of the navbar. Something like this: view image here The circle is not a button and should be centered on the border of the navb ...

Issue: Invalid element type detected: expected a string (for built-in components) or a class/function

Currently, I am in the process of learning how to make API calls using React Redux. I decided to practice by implementing an example in StackBlitz. However, I encountered an error after selecting a channel and clicking on the 'Top News' button. C ...

What sets apart certain comparable selenium waits from each other?

Curious about the differences: I'm wondering what sets apart these two statements: WebDriverWait(self._driver, WEB_WAIT_TIMEOUT).until(ec.invisibility_of_element_located(element)) and WebDriverWait(self._driver, WEB_WAIT_TIMEOUT).until_not(ec.pres ...

Align text to the left and right with a centered div

Visualize the asterisk * at the center of the div textAlignRight * text AlignLeft This is essentially my goal to accomplish <center> <span class="left_host">Right aligned</span> * <span class="righ ...

Here are the steps to effectively incorporate CSS classes in a form using Laravel Collective 5.2 framework

Hi there, I am currently working on developing an application and find myself in need of implementing CSS classes to a form using Collective Laravel "5.2.*". The snippet of code that I have at the moment is as follows: {!! Form::model($user, array(&apos ...

Retrieve the DOM variable before it undergoes changes upon clicking the redirect button

I have been struggling for a long time to figure out how to maintain variables between page refreshes and different pages within a single browser session opened using Selenium in Python. Unfortunately, I have tried storing variables in localStorage, sessio ...

Are there any instances where CSS is overlooking certain HTML elements?

In the following HTML code snippet, the presence of the element with class ChildBar is optional: <div class="Parent"> <div class="ChildFoo"></div> <div class="ChildBar"></div> <!-- May ...

Apply a Fade In transition to the ul li elements following a JavaScript toggle

I'm currently experimenting with implementing a Fade in from the right animation for the links displayed in the menu after toggling the menu body in the browser. Despite my efforts, I am unable to determine why the animation is not functioning as expe ...

Is there a way to execute this script multiple times in Python?

I'm considering whether or not to use a for loop in this scenario. This entire script is necessary to accomplish a single task. I am looking to run this script approximately 100 times: driver.find_element_by_class_name("submit").click() time.sleep( ...