selenium - Robot: Backslash in EXECDIR, Windows path -



selenium - Robot: Backslash in EXECDIR, Windows path -

underlying problem: want enable running robot tests using selenium 2 in portable firefox that's stored within execdir.

${firefox_binary}= evaluate sys.modules['selenium.webdriver.firefox.firefox_binary'].firefoxbinary('${execdir}${/}firefox${/}app${/}firefox${/}firefox.exe') sys, selenium.webdriver ${firefox_profile}= evaluate sys.modules['selenium.webdriver.firefox.firefox_profile'].firefoxprofile('${execdir}${/}lib${/}seleniumfirefoxprofile') sys, selenium.webdriver create webdriver firefox firefox_binary=${firefox_binary} firefox_profile=${firefox_profile}

that works fine if, instead of ${execdir}, utilize actual path.

execdir c:\users\bart.simpson\workspace\projectname here. issue backslash, when followed b, converted ascii backslash character. test log says:

evaluating look 'sys.modules['selenium.webdriver.firefox.firefox_profile'].firefoxprofile('c:\users\bart.simpson\workspace\projectname\lib\seleniumfirefoxprofile')' failed: oserror: [errno 20047] unknown error: 20047: 'c:\\users\x08art.simpson\\workspace\\projectname\\lib\\seleniumfirefoxprofile'

of course of study i've tried using ${fixedexecdir}= replace string ${execdir} '\' '/' , such, nil ever changes outcome.

ideas? thanks.

try treating path raw string literal, putting "r" before quote before ${execdir}:

${firefox_binary}= evaluate ....firefoxbinary(r'${execdir}${/}firefox...')

this should work because robot variables substituted before string passed python, python interpreter ever sees finish string.

if unfamiliar python raw string literals, see question:

what “u” , “r” string flags in python, , raw string literals?

windows selenium robotframework backslash

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -