jquery - Javascript void(0) click or execute using selenium python -


i trying scrape website using selenium , python. however, need click on button show required information. website reduce points out of account when ever button click , accept that. want automate process selenium , scrape site. new both python , selenium. can me on how click such button or executing script?

my current code is:

driver.find_elements_by_xpath("//*[@id='show_info_button']") 

it not return errors, button wasn't clicked. have tried driver.execute_script. not sure function name trying execute have posted html of button below.

here html of button:

<a href="javascript:void(0);" id="show_info_button" class="btn btn-big btn-danger text-center">xem thông tin ứng viên</a>  <script type="text/javascript">          $(document).ready(function() {             $process = false;             $('#show_info_button').click(function() {                 if (!$process) {                     $process = true;                     $.ajax({                         url: 'https://www.timviecnhanh.com/ho-so-show-info-point/ajax',                         type: 'get',                         datatype : 'json',                         data: {                             employer_id: '2677857',                             resume_id: '4065839',                             package: '100',                             remain_point: '611',                             remain_point_gift: '0',                             resume_point: '2'                         },                         async: false,                         success: function(response) {                             if (typeof response != 'undefined') {                                                                                                             $('#remain_point').text(parseint($("#remain_point").text(), 10) - parseint($("#resume_point").text(), 10));                                  $('#show_info_point').html(response.info);                                 $('#show_info_point_hide').hide();                                 if (typeof response.dinhkem != 'undefined') {                                     $('#preview-attach').html(response.dinhkem);                                     $('#preview-attach-resume-meta').hide();                                     $dinhkem_base64 = response.dinhkem_base64;                                 }                                 $('#show_info_button').hide();                                 $('#send_mail').append("<a href='https://www.timviecnhanh.com/nha-tuyen-dung/lien-he-nguoi-tim-viec?id=4065839&job_id=&last_cache_name=' class='btn btn-primary btn-send-mail'>gửi mail</a>");                                 $('#send_mail_contact').append("<a href='https://www.timviecnhanh.com/nha-tuyen-dung/lien-he-nguoi-tim-viec?id=4065839&job_id=&last_cache_name=' class='btn btn-primary btn-send-mail'>gửi mail liên hệ</a>");                                 $('#btn_view_attach').hide();                              } else {                                 alert('lỗi, refresh lại trình duyệt.');                             }                         }                     }).done(function() {                         // $process = false;                     });                 }             });         });     </script>         $(document).ready(function() {             $process = false;             $('#show_info_button').click(function() {                 if (!$process) {                     $process = true;                     $.ajax({                         url: 'https://www.timviecnhanh.com/ho-so-show-info-point/ajax',                         type: 'get',                         datatype : 'json',                         data: {                             employer_id: '2677857',                             resume_id: '4065839',                             package: '100',                             remain_point: '611',                             remain_point_gift: '0',                             resume_point: '2'                         },                         async: false,                         success: function(response) {                             if (typeof response != 'undefined') {                                                                                                             $('#remain_point').text(parseint($("#remain_point").text(), 10) - parseint($("#resume_point").text(), 10));                                  $('#show_info_point').html(response.info);                                 $('#show_info_point_hide').hide();                                 if (typeof response.dinhkem != 'undefined') {                                     $('#preview-attach').html(response.dinhkem);                                     $('#preview-attach-resume-meta').hide();                                     $dinhkem_base64 = response.dinhkem_base64;                                 }                                 $('#show_info_button').hide();                                 $('#send_mail').append("<a href='https://www.timviecnhanh.com/nha-tuyen-dung/lien-he-nguoi-tim-viec?id=4065839&job_id=&last_cache_name=' class='btn btn-primary btn-send-mail'>gửi mail</a>");                                 $('#send_mail_contact').append("<a href='https://www.timviecnhanh.com/nha-tuyen-dung/lien-he-nguoi-tim-viec?id=4065839&job_id=&last_cache_name=' class='btn btn-primary btn-send-mail'>gửi mail liên hệ</a>");                                 $('#btn_view_attach').hide();                              } else {                                 alert('lỗi, refresh lại trình duyệt.');                             }                         }                     }).done(function() {                         // $process = false;                     });                 }             });         }); 

i have found out solution problem. actual problem not .click() function. can click on sort of button. problem lies within tab management.

because href opened in new tab, did not know have switch focus new tab.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -