Files
gommi/lib/system/__pycache__/logic_selenium.cpython-310.pyc

99 lines
9.5 KiB
Plaintext
Raw Normal View History

2022-04-21 19:23:01 +09:00
o
+ab<61>A<00>@s<>ddlZddlZddlZddlZddlZddlZddlmZmZm Z m
Z
m Z m Z m Z zddlmZddlmZddlmZde_WnYddlmZddlmZddlmZmZd d
lmZmZd d lm Z Gd d <0A>d e!<21>Z"dS)<0E>N)<07> Blueprint<6E>request<73>Response<73> send_file<6C>render_template<74>redirect<63>jsonify)<01> webdriver)<01> WebDriverWait)<01>Image)<01>BytesIO)<01>
get_logger)<02> path_app_root<6F> path_data<74>)<02>logger<65> package_name<6D><01> ModelSettingc@s<>eZdZdZgZedd<03><00>Zed!dd<06><01>Zed"dd<08><01>Zed"d d
<EFBFBD><01>Z ed d <0C><00>Z
ed d<0E><00>Z edd<10><00>Z edd<12><00>Z ed#dd<15><01>Zedd<17><00>Zed"dd<19><01>Zed"dd<1B><01>Zed"dd<1D><01>Zed$dd <20><01>ZdS)%<25>SystemLogicSeleniumNc
Cs<>z<>|dkrt<00><01>}|<02>|jd<00>td<03>WS|dkrht<00><01>}t<05>t|<02><08><00><01>}t <09> <09>}t
|<04><01> d<05>d}t j <0A>tdd|<00>}|<03>|<05>dd lm}|<06>d
<EFBFBD>}d ||f}t<13>|<08>i} d| d <|| d <t| <09>WS|dkr<>t<00><01>}t<00>|<02>}t <09> <09>}t
|<04><01> d<05>d}t j <0A>tdd|<00>}|<03>|<05>t|dd<10>WS|dkr<>t<00><01>}|<02><17>}
t|
<EFBFBD>WS|dkr<>|jd} t<00><01>}|<02>d<13><01>| <0B>|<02>dd<00><01><1A>td di<01>WSWdSty<>} zt<13>d| <0C>t<13>t<1D><1E><00>td<17>WYd} ~ Sd} ~ ww)NZselenium_test_go<67>url<72>success<73>capture<72>.r<00>tmpz%s.pngr<00>ddnsz%s/open_file%s<>ret<65>dataZ full_capturez image/png)<01>mimetype<70>cookie<69> daum_capchaz//input[@id="answer"]z//input[@value="%s"]u확인<ED9995> Exception:%s<> exception)r<00>
get_driver<EFBFBD>get<65>formrr <00>openr <00>get_screenshot_as_png<6E>time<6D>str<74>split<69>os<6F>path<74>joinr<00>save<76> system.modelrr<00>debug<75>full_screenshotrZ get_cookies<65>find_element_by_xpathZ send_keys<79>click<63> Exception<6F>error<6F> traceback<63>
format_exc) <0A>sub<75>req<65>driver<65>img<6D> timestampr<00>SystemModelSettingrrrrr r"<00>r><00>G/Volumes/WD/Users/Work/python/gommi-server/lib/system/logic_selenium.py<70> process_ajax2sd

 
 






<04><02><06> <08><02>z SystemLogicSelenium.process_ajaxTc
s<>z t<00>d|<00><00>t<02><03>}|<03>|<00>t|d<02><02><06>fdd<04><08>|jWStyT}z(t<00> d|<04>t<00> t
<EFBFBD> <0B><00>t<02> <0C>|rItj |<00>dd<07>WYd}~SWYd}~dSd}~ww)Nz get_pagesoruce_by_selenium:%s %s<>
cs
|<00><00><00>S<00>N)r2<00>r:<00><01>
wait_xpathr>r?<00><lambda>ps
z@SystemLogicSelenium.get_pagesoruce_by_selenium.<locals>.<lambda>r!F)<01>retry)rr0rr#r$r
ZuntilZ page_sourcer4r5r6r7<00> close_driver<65>get_pagesoruce_by_selenium)rrErGr:r"r>rDr?rIgs&


<04> <12><0E><08><02>z.SystemLogicSelenium.get_pagesoruce_by_seleniumc
Cs`ztjdur t<00>|<00>t_tjWSty/}zt<04>d|<01>t<04>t<06><07><00>WYd}~dSd}~ww<00>Nr!)r<00> chrome_driver<65>inner_create_driverr4rr5r6r7)<02>chrome_optionsr"r>r>r?r#<00>s
<04> <08><02>zSystemLogicSelenium.get_driverc
Cslzt<00>|<00>}|durtj<02>|<01>|WSWdSty5}zt<05>d|<02>t<05>t<07><08><00>WYd}~dSd}~wwrJ) rrL<00>chrome_driver_list<73>appendr4rr5r6r7)rMr:r"r>r>r?<00> create_driver<65>s
 <06> <08><02>z!SystemLogicSelenium.create_driverc
Cs<>z5tjdur3ztj<01><02>Wn tyYnwt<04>d<01>ztj<01><06>Wn ty,Ynwdt_WdSWdStyU}zt<07>d|<00>t<07>t <09>
<EFBFBD><00>WYd}~dSd}~ww)N<>r!) rrK<00>closer4r(<00>sleep<65>quitrr5r6r7)r"r>r>r?rH<00>s(
 <02>
 <02> <06> <08><02>z SystemLogicSelenium.close_driverc
CsNz<>d}t<00>d<01>}|<02>d<02>r|dd<03>}|dkrD|dur.t<03><04>}t<00>d<05>}|D]}|<00>|<04>q&tj||<00><08>d<06>}|<01> dd<08>t
<EFBFBD> d |<01>n9t j <0A>td
t<10><11>d <0B>}t<10><11>d krY|d 7}|durpt<03><04>}t<00>d<0E>}|D]}|<00>|<04>qhtj||d<0F>}t
<EFBFBD> d|<01>|dur<>|WSWdSty<>}zt
<EFBFBD>d|<06>t
<EFBFBD>t<15><16><00>WYd}~dSd}~ww)N<>selenium_remote_urlz/wd/hub/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><00>selenium_remote_default_option)Zcommand_executorZdesired_capabilitiesi<73>i8zUsing Remote :%s<>binZ chromedriver<65>Windowsz.exe<78>selenium_binary_default_option)rMzUsing local bin :%sr!)rr$<00>endswithr Z ChromeOptions<6E>get_list<73> add_argumentZRemoteZto_capabilitiesZset_window_sizerr0r+r,r-r<00>platform<72>systemZChromer4r5r6r7)rMr:Z
remote_urlr<00>tZ path_chromer"r>r>r?rL<00>sV

 <04> <06>  <04> <04> <06> <06> <08><02>z'SystemLogicSelenium.inner_create_driverc
Cslzt<00><01>tjD]
}|dur|<00><03>qWdSty5}zt<05>d|<01>t<05>t<07><08><00>WYd}~dSd}~wwrJ) rrHrNrTr4rr5r6r7)rr"r>r>r?<00> plugin_unload<61>s
<02><06> <08><02>z!SystemLogicSelenium.plugin_unloadcCs |<00>d|<01>S)Nz<4E>
return jQuery(arguments[0]).contents().filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).text();
<20><01>execute_script<70>r:<00>elementr>r>r?<00>get_text_excluding_children<65>s<04>z/SystemLogicSelenium.get_text_excluding_childrenrc
Cs8z{g}d}|<00>d<02>}|<00>d<03>}||krG|<00>d|<03>t<01>t|<00><04><00><01>}|dkr3|<06>dd|j|j|f<04>}|<02>|<06>||7}t <09>
d||<05>||kst dd<07>|D<00><01>}t<01> d|dj d|f<02>}d}|D]} |<08>| d|f<02>|| j d 7}t <09>
d
|<03>qa|WSty<>}
zt <09>d |
<EFBFBD>t <09>t<11><12><00>WYd}
~
dSd}
~
ww) NrzKreturn Math.max(document.documentElement.clientHeight, window.innerHeight);z<>return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);zC
window.scrollTo(0, arguments[0]);
zoffset : %s / %scSsg|]}|jd<00>qS)r)<01>size)<02>.0<EFBFBD>img_fragr>r>r?<00>
<listcomp>*sz7SystemLogicSelenium.full_screenshot.<locals>.<listcomp>ZRGBrzpaste offset : %s r!)rdr r&r r'Zcrop<6F>width<74>heightrOrr0<00>sum<75>newrhZpaster4r5r6r7) r:Z
low_offsetZimg_li<6C>offsetrmZmax_window_heightr;Zimg_frame_heightZ img_framerjr"r>r>r?r1<00>sH<04><04> <04><04>
<08> <08><02>z#SystemLogicSelenium.full_screenshotcCs|<00>d|<01>dS)Nz^
var element = arguments[0];
element.parentNode.removeChild(element);
rcrer>r>r?<00>remove_element8s<08>z"SystemLogicSelenium.remove_elementcCs0|durt<00><01>}|j<02>d<01>s|<00>d<02>|<00>d<03>S)N<>chrome://downloadszchrome://downloads/zxreturn downloads.Manager.get().items_ .filter(e => e.state === 'COMPLETE') .map(e => e.filePath || e.file_path); )rr#<00> current_url<72>
startswithr$rdrCr>r>r?Z__get_downloaded_filesCs 
<04>z*SystemLogicSelenium.__get_downloaded_filescCsl|durt<00><01>}|<01>d<01>}|<02>d|g|d<03><02>|<01>d|<02>}|<03>d<05>s(td|<00><01>t<07>||<03> d<07>dd<00><00>S) Nz<4E>var input = window.document.createElement('INPUT'); input.setAttribute('type', 'file'); input.hidden = true; input.onchange = function (e) { e.stopPropagation() }; return window.document.documentElement.appendChild(input); ZsendKeysToElement)<02>value<75>textz<74>var input = arguments[0], callback = arguments[1]; var reader = new FileReader(); reader.onload = function (ev) { callback(reader.result) }; reader.onerror = function (ex) { callback(ex.message) }; reader.readAsDataURL(input.files[0]); input.remove(); zdata:zFailed to get file content: %szbase64,<2C>)
rr#rdZ_executeZexecute_async_scriptrtr4<00>base64<36> b64decode<64>find)r,r:<00>elem<65>resultr>r>r?<00>get_file_contentPs<04><04>
z$SystemLogicSelenium.get_file_contentcCs|durt<00><01>}t<00><02>}|SrB)rr#<00>*_SystemLogicSelenium__get_downloaded_files)r:<00>filesr>r>r?<00>get_downloaded_filesnsz(SystemLogicSelenium.get_downloaded_files<65>XcCs<>|durt<00><01>}|<01>d<01>|j<03>|jd<00>|<01>d<03>t<07><07>|} z|<01>d<05>}|dkr/|WSWnYt<07>d<07>t<07><07>|krBdSq")Nz window.open()rVrrTz<54>return document.querySelector('downloads-manager').shadowRoot.querySelector('#downloadsList downloads-item').shadowRoot.querySelector('#progress').value<75>dr) rr#rdZ switch_toZwindowZwindow_handlesr$r(rS)ZmaxTimer:ZendTimeZdownloadPercentager>r>r?<00>waitUntilDownloadCompletedws(

 <04><04>
 <02>z.SystemLogicSelenium.waitUntilDownloadCompleted)TrB)r)r<>N)<14>__name__<5F>
__module__<EFBFBD> __qualname__rKrN<00> staticmethodr@rIr#rPrHrLrbrgr1rqr~r}r<>r<>r>r>r>r?r.s>
4   

+


?

  r)#r+r6<00>loggingr_r(rx<00>flaskrrrrrrr<00>seleniumr Zselenium.webdriver.support.uir
ZPILr ZMAX_IMAGE_PIXELS<4C>ior <00>framework.loggerr <00> frameworkrr<00>pluginrr<00>modelr<00>objectrr>r>r>r?<00><module>s.$
  
   i