如何点击网站上显示的“立即申请”按钮和下面的代码?
我已经尝试了标准的findElement,将鼠标悬停在Selenium Actions上,甚至执行javscript,但没有运气。有任何想法吗?谢谢!
<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">
答案 0 :(得分:0)
您可以使用类名,css选择器或xpath。
driver.findElemenet(By.className("indeed-apply-button")).click()