S
S
Sergey Yavin2020-09-20 23:20:05
Python
Sergey Yavin, 2020-09-20 23:20:05

How to write text in a field, selenium python?

Hello to those who responded. The difficulty arose in the following. There is a text editor on the site that has the function of switching to HTML code mode.
5f67b41ebbd00694754866.png
5f67b95eb6253902016708.png
Without turning on this mode, I can easily insert my values ​​into the reactor, but I need to insert exactly the text with html code, for this I need to enable the code mode. I do it through selenium webdriver. I can't figure out which HTML element is responsible for the text in this field.

<div class="CodeMirror-scroll" tabindex="-1">
   <div class="CodeMirror-sizer" style="margin-left: 29px; min-height: 22px;">
      <div style="position: relative; top: 0px;">
         <div class="CodeMirror-lines">
            <div style="position: relative; outline: none;">
               <div class="CodeMirror-measure">
                  <pre><span>xxxxxxxxxx</span></pre>
                  <div class="CodeMirror-linenumber CodeMirror-gutter-elt">
                     <div>1</div>
                  </div>
               </div>
               <div class="CodeMirror-measure"></div>
               <div style="position: relative; z-index: 1;"></div>
               <div class="CodeMirror-cursors">
                  <div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 14px;">&nbsp;</div>
               </div>
               <div class="CodeMirror-code">
                  <div style="position: relative;">
                     <div class="CodeMirror-gutter-wrapper" style="position: absolute; left: -29px;">
                        <div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 20px;">1</div>
                     </div>
                     <pre class=""><span style="padding-right: 0.1px;">выываыва</span></pre>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
   <div style="position: absolute; height: 30px; width: 1px; top: 22px;"></div>
   <div class="CodeMirror-gutters" style="height: 291px;">
      <div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 28px;"></div>
   </div>
</div>


Or maybe there is another way to paste text into the code editor using python?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question