can we change the css , html values using splinter

2019-08-17 04:55发布

问题:

can i change the value of any html , css thing using splinter or selenium like we can do with inspect element :

  `<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
  0
  <input type="range" id="a" name="a" value="50">
  100 +
  <input type="number" id="b" name="b" value="50">
  =
  <output name="x" for="a b"></output>
  <br><br>
  <input type="submit">
</form>`

can i select <input type="range" id="a" name="a" value="50"> and can change the value="30" by using splinter or selenium ?

Like if this is html code :

<div class="medium-widget success-story-category">
                        <h2 class="widget-title"><span aria-hidden="true" class="icon-get-started"></span>Getting Started</h2>
<p>Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages. The following pages are a useful first step to get on your way writing programs with Python!</p>
<ul>
    <li><a href="https://wiki.python.org/moin/BeginnersGuide/Programmers">Beginner's Guide, Programmers</a></li>
    <li><a href="https://wiki.python.org/moin/BeginnersGuide/NonProgrammers">Beginner's Guide, Non-Programmers</a></li>
    <li><a href="https://wiki.python.org/moin/BeginnersGuide/Download">Beginner's Guide, Download &amp; Installation</a></li>
    <li><a href="https://wiki.python.org/moin/BeginnersGuide/Examples">Code sample and snippets for Beginners</a></li>
</ul>

                    </div>
  • can i change <p> tag to <h1> ?

  • can we add something to existing tag like <p> tag to

    to <p style="color:red;"> ?

I tried to look this question but have not found the solution.

回答1:

You can't do that with those tools. You need to use JavaScript.