Skip to content
Advertisement

How to make function to fix a href link? [closed]

Is there requests/selenium function to convert a href link to proper link like :

clickLink("https://www.google.com","about")

returns value like https://www.google.com/about ?

like it fix a href link and converts to regular link

e.g.

JavaScript

etc

I try make one but with no luck

JavaScript

Advertisement

Answer

You can use “urljoin” function in urllib.parse. Here’s an example.

JavaScript

PS. http://www.example.com/ actually exists.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement