''' print('!= test reload') runner.b.execute_script('fetch("https://_xmcp_pakku_internal_test_domain.bilibili.com/change_taolus_and_reload")') time.sleep(3) assert 'pakku_another_str' in runner.b.find_element_by_css_selector('.bilibili-player .danmaku-info-row:first-child').text assert len(runner.b.find_elements_by_css_selector('.bilibili-player .bilibili-player-video-progress canvas'))==1 ''' runner.update_settings('FORCELIST','[]') print('!= test ajax hook') runner.set_global_switch(False) runner.b.get('http://www.bilibili.com/favicon.ico') time.sleep(.5) # wait for ajax hook assert '[x' not in runner.parse_ajax(EXAMPLE_DANMAKU) runner.set_global_switch(True) runner.b.get('http://www.bilibili.com/favicon.ico') time.sleep(.5) # wait for ajax hook assert '[x' in runner.parse_ajax(EXAMPLE_DANMAKU) assert '[x' not in runner.parse_ajax(EXAMPLE_DANMAKU+'?pakku_test') print('!= test working') danmus=runner.parse_string(demo('unicode')) assert len(danmus)==1 assert danmus[0].childNodes[0].data=='testtest[]【】' assert len(runner.parse_string(demo('different_100')))==100 print('!= test danmu mark')
src = runner.get_source() dom = parseString(src) assert len(dom.childNodes) == 1 assert dom.childNodes[0].tagName == 'i' danmu = dom.getElementsByTagName('d')[0] assert len(danmu.getAttribute('p').split(',')) > 3 assert len(danmu.childNodes) == 1 assert isinstance(danmu.childNodes[0], Text) print('!= test ajax hook') runner.set_global_switch(False) runner.b.get('http://www.bilibili.com/favicon.ico') time.sleep(.5) # wait for ajax hook assert '[x' not in runner.parse_ajax('//comment.bilibili.com/1.xml') runner.set_global_switch(True) runner.b.get('http://www.bilibili.com/favicon.ico') time.sleep(.5) # wait for ajax hook assert '[x' in runner.parse_ajax('//comment.bilibili.com/1.xml') assert '[x' not in runner.parse_ajax( 'http://comment.bilibili.com/1.xml?pakku_test') print('!= test working') danmus = runner.parse_string(demo('unicode')) assert len(danmus) == 1 assert danmus[0].childNodes[0].data == 'testtest[]【】' assert len(runner.parse_string(demo('different_100'))) == 100