← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #197423]: how to set the URL

 

Question #197423 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/197423

Ken Mayer posted a new comment:
The following code will work only for Windows systems, but it is an easy
way to open a URL from Sikuli. Since I didn't find the whole answer
anywhere, here's what worked for me. I used os,popen() to open cmd and
start a url in the default browser.

#example1 -- raw string
import os
# Note that because the ampersand ("&") is reserved in Batch file processing
# the ampersands in the query string need to have a caret (^) in front of them
cmd = r'start /B "" "http://annapolis.craigslist.org/search/msa?query=mandolin^&maxAsk=200";'
os.popen(cmd);

# example2 -- concatenation
import os
# with a variable URL, I opted not to mess with raw string format, but just concatenated these into the mix
urlVariable[recordsCount] = 'http://annapolis.craigslist.org/search/msa?query=mandolin^&maxAsk=200'
cmd1 = 'start /B \"\" \"'
cmd2 ='\"'

os.popen(cmd1+ urlVariable[recordsCount] +cmd2);

I hope this helps!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.