KemerDev-C
KemerDev-C

Reputation: 308

How to pass special characters in the URL when using selenium in python

My queryUrl variable holds this string

queryUrl = "https://www.coursera.org/search?query=data%20science&index=prod_all_launched_products_term_optimization_skills_test_for_precise_xdp_imprecise_variant&topic=data%20science&entityTypeDescription=Courses"

but when i pass it to the driver like this

self.driver.get(queryUrl)

and the browser opens, the URL has this look

https://www.coursera.org/search?query=data science&index=prod_all_launched_products_term_optimization_skills_test_for_precise_xdp_imprecise_variant&topic=data science&entityTypeDescription=Courses

The %20 special character for space becomes a white space, while i need %20 special character.

What am'i doing wrong?

Upvotes: -1

Views: 271

Answers (1)

hassan abbas
hassan abbas

Reputation: 72

using + instead of %20 should work just fine

Upvotes: 1

Related Questions