Selenium and Python: remove \n from returned selenium.get_text() -
when call selenium.get_text("foo") on element returns different value depending on browser working in due way each browser handles newlines.
example:
an elements string "hello[newline]how today?[newline]very well, thank you."
when selenium gets ie gets string "hello\nhow today?\nvery well, thank you."
when selenium gets firefox gets string "hello\n how today?\n well, thank you."
(notice ie changes [newline] '\n' , firefox changes '\n ')
is there anyway using selenium/python can strip out discrepancy?
i thought using .replace("\n ", "\n"), cause issues if there intended space after newline (for whatever reason).
any ideas?
i ended doing check of browser running , returning string '\n ' replaced '\n' if browser firefox.
Comments
Post a Comment