javascript - Python selenium getting data while hovering -


driver.get(link) time.sleep(2) lol = driver.find_element_by_xpath("//*[@id='table_div']/div/div[1]/table/tbody/tr[2]/td[10]/div/div") hover = actionchains(driver).move_to_element(lol) hover.perform() 

here code have far. trying text shows when hover on element. found element selenium, , hovering on it, can't figure out how data. looks data not there when inspect element, , can see in javascript when view page source. it's variable, how variable value javascript?

javascript:

   function apply_pop(){    jq(".pop_up").mouseenter(function(p_event){    p_value = jq(this).attr("value")    //creating dynamic lists python static storage    var data_list = ['0', '2015-07-13 17:29:15'];     var desp_list = [['running 1000.0 none', 'invalid none none', 'invalid none none', 'passed 0.05 2015-07-10 17:21:54', 'failed 0.05 2015-07-08 12:35:55', 'failed 0.05 2015-07-08 09:54:48', 'failed 0.05 2015-07-07 18:21:17', 'failed 0.05 2015-07-07 17:07:50', 'failed 0.05 2015-05-28 18:33:41'], ['failed 0.05 2015-07-13 16:33:38', 'failed 0.05 2015-07-10 15:36:30', 'failed 0.05 2015-07-09 19:39:46', 'failed 0.05 2015-07-09 11:00:45', 'failed 0.05 2015-07-09 01:05:13', 'invalid none none', 'invalid none none', 'failed 0.05 2015-06-19 22:42:21']]    ...}; 

i want first thing in desp_list (running 1000.0 none)

we can argue reliability of approach, if page source , extract desired data via regex. usually, parsing html regular expressions not idea, here don't care structure of page , need part of javascript array. sample code (not tested):

import re  # ...  page_source = driver.page_source  pattern = re.compile(r"var desp_list = \[\['(.*?)',") match = pattern.search(page_source, re.multiline | re.dotall) print match.group(1) if match else "no match" 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -