sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #19951
Re: [Question #216012]: Facing problems while trying to open a url using jython scripting
Question #216012 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/216012
Ken Mayer posted a new comment:
I finally figured out how to easily 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.