alias exemyfile="ruby myrubyfile.rb"
then enter exemyfile command in your terminal, it works as you want.
system(“.ruby”)或者load 'another.rb'具体代码如下:
# 返回ls的输出
s=`ls`
cmd= "ls"
s= `#{cmd}`
# 返回true or false
s= system('ls')
cmd= 'ls'
s= system(cmd)
#返回输出
s= %x[uptime]
#用top进程替换当前ruby进程
exec "top"
cmd = 'top'
exec cmd
如果是弹出窗口页的话需要先把焦点转到这个窗口。###Ahelpermethodtowaitthepopupwindowtobeclosed#defwait_close_popup_windowi=0whilepage.driver.browser.window_handles.size>1sleep0.3i=i+0.3ifi>3breakend