can we change the css , html values using splinter , beautiful soup or selenium?

99封情书 提交于 2020-01-07 04:55:47

问题


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.



来源:https://stackoverflow.com/questions/46468644/can-we-change-the-css-html-values-using-splinter-beautiful-soup-or-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!