File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 7
7
</ script >
8
8
< script >
9
9
mytest ( 2 ) ;
10
+ document . write ( '<p id="result2">' + mytest . toString ( ) + '</p>' ) ;
10
11
</ script >
11
12
</ body > </ html >
Original file line number Diff line number Diff line change 2
2
import os
3
3
import shutil
4
4
import subprocess
5
+ import platform
6
+ from subprocess import Popen , PIPE
5
7
6
8
from selenium import webdriver
7
9
from selenium .webdriver .chrome .options import Options
19
21
subprocess .call ([nwjc , "mytest.js" , "mytest.bin" ])
20
22
assert (os .path .isfile (binfile ))
21
23
24
+ if platform .system () == 'Linux' :
25
+ proc = Popen (['strings' , 'mytest.bin' ], stdout = PIPE , stderr = PIPE )
26
+ out , err = proc .communicate ()
27
+ print out
28
+ assert ("42" not in out )
29
+
22
30
driver = webdriver .Chrome (executable_path = os .environ ['CHROMEDRIVER' ], chrome_options = chrome_options )
23
31
try :
24
32
print driver .current_url
25
33
time .sleep (1 )
26
34
result = driver .find_element_by_id ('result' )
27
35
print result .get_attribute ('innerHTML' )
28
36
assert ("44" == result .get_attribute ('innerHTML' ))
37
+ result2 = driver .find_element_by_id ('result2' )
38
+ print result2 .get_attribute ('innerHTML' )
39
+ assert ("native code" in result2 )
29
40
finally :
30
41
driver .quit ()
You can’t perform that action at this time.
0 commit comments