javascript - selenium and phantomjs being detected right after entering the website? -
here's website: http://wsjs.saic.gov.cn default language chinese can set english anyway. have encrypted js use chrome keywords believe related function blocks bots. code :
# -*- coding: utf-8 -*- import sys selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.action_chains import actionchains selenium.webdriver.common.desired_capabilities import desiredcapabilities import time import requests reload(sys) sys.setdefaultencoding('utf-8') headers = { 'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'accept-language':'en-us,en;q=0.8,zh-cn;q=0.6,zh;q=0.4,zh-tw;q=0.2,ru;q=0.2', 'accept-encoding':'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'mozilla/5.0 (windows nt 6.2; wow64; rv:47.0) gecko/20100101 firefox/47.0' } key, value in headers.iteritems(): webdriver.desiredcapabilities.phantomjs['phantomjs.page.customheaders.{}'.format(key)] = value webdriver.desiredcapabilities.phantomjs['phantomjs.page.settings.useragent'] = 'mozilla/5.0 (windows nt 6.2; wow64; rv:47.0) applewebkit/537.36 (khtml, gecko) chrome/48.0.2564.116 safari/537.36' print 'yeah' url = 'http://wsjs.saic.gov.cn/' driver = webdriver.phantomjs() driver.get(url) driver.maximize_window() time.sleep(5) driver.save_screenshot('fk1.png') i these keywords in js files using chrome debug.
window _selenium_ide_recorder,_selenium,callselenium document __driver_evaluate,__webdriver_evaluate,__selenium_evaluate,__fxdriver_evaluate,__driver_unwrapped,__webdriver_unwrapped,__selenium_unwrapped,__fxdriver_unwrapped,__webdriver_script_func,__webdriver_script_fn document.documentelement.getattribute ["selenium", "webdriver", "driver"] window callphantom,_phantom now need know how can away it. need recompile phantomjs script work?
upate: sine nobody answered question, had work on on own.and figured out callphantom _phantom 2 apis exposed can called website know. , there's no page.oninitialized api selenium had use phantomjs without webdriver , managed page , start inputting info on webpage.
then realized there's problem. check mouse movement detect if you're bot. here keywords check:
mousemove`mousedown`mouseup`mouseover`mouseout`keydown`keycode i don't know how since barely know js. how past detection.i noticed there're keywords 'abort dispatevent'.
Comments
Post a Comment