如何单击网站和下面的代码所示的“立即申请”按钮?

我尝试了标准的findElement,使用Selenium Actions进行了悬停,甚至执行了javscript,但没有运气。有任何想法吗?谢谢!

http://www.indeed.com/viewjob?jk=fd5fae9c8825702b&q=java&l=San+Francisco+Bay+Area%2C+CA&tk=18qk10l871d2i1hp&from=web

<p style="height:55px;overflow:hidden;"> <span style="padding: 0px ! important; margin: 0px ! important; text-indent: 0px ! important; vertical-align: top ! important; position: relative; display: inline-block;" class="indeed-apply-widget indeed-apply-button-container indeed-apply-status-not-applied" data-indeed-apply-apitoken="2e4c33bed2e10444a2f575136a9476c58b8b1291a9cbd0824694fa89ac09d381" data-indeed-apply-jobid="fd5fae9c8825702b" data-indeed-apply-joblocation="San Francisco, CA" data-indeed-apply-jobcompanyname="Supercool School" data-indeed-apply-jobtitle="Supercool Designer Wanted" data-indeed-apply-joburl="http://www.indeed.com/job/Supercool-Designer-at-Supercool-School-in-San-Francisco,-CA-fd5fae9c8825702b" data-indeed-apply-name="" data-indeed-apply-onapplied="indeed_apply_callback" data-indeed-apply-onclick="indeed_apply_onclick" data-indeed-apply-jk="fd5fae9c8825702b" data-indeed-apply-jobmeta="viewjob-bottom" data-indeed-apply-email="781601ccad3e06e0a9aa90626fe8d4a1c0eb314dffe73765b4f252173c92cc2c" data-indeed-apply-locale="en_US"><a id="indeed-ia-1403234617911-0" href="javascript:void(0);" class="indeed-apply-button"><span id="indeed-ia-1403234617911-0inner" class="indeed-apply-button-inner"><span id="indeed-ia-1403234617911-0label" class="indeed-apply-button-label">Apply Now</span><span class="indeed-apply-button-cm"><img style="border: 0px none;" src="Supercool%20Designer%20Wanted%20job%20-%20Supercool%20School%20-%20San%20Francisco,%20CA%20%7C%20Indeed.com_files/check.png"></span></span></a></span> <script>(function(d, s, id) { var js, iajs = d.getElementsByTagName(s)[0], iaqs = 'vjtk=18qrkq1l81d4h6mp'; if (d.getElementById(id)){return;} js = d.createElement(s); js.id = id;js.async = true; js.src = "https://apply.indeed.com/indeedapply/static/scripts/app/bootstrap.js?hl=en_US&co=US"; iaqs += '&tk=' + '18qk10l871d2i1hp'; js.setAttribute('data-indeed-apply-qs', iaqs); iajs.parentNode.insertBefore(js, iajs); }(document, 'script', 'indeed-apply-js')); </script> <script type="text/javascript" src="Supercool%20Designer%20Wanted%20job%20-%20Supercool%20School%20-%20San%20Francisco,%20CA%20%7C%20Indeed.com_files/conversionv2.js" async="true"></script> <script type="text/javascript">

最佳答案

您可以使用类名,或使用CSS选择器或xpath。

driver.findElemenet(By.className("indeed-apply-button")).click()

09-07 23:28