1

I have a scenario where I need to call a rest API in my python selenium script but I am not sure how to do it.

If anyone as idea on it can you please help me out .

The API used is to delete the phone number.

3

Request is the Python built-in HTTP library.

r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print( r.status_code ) # Print 200

If you want to systematic valid Rest Endpoints, you may want to look at pyresttest or Tavern.

0

Selenium just controls the browser, it is not intended to make rest calls. Selenium only lets you to GET particular URL (as you do when you request a regular html page from a server) using driver.get(..).

However I believe this is not your case because implementing data editing using GET requests is a sort of bad practice since it exposes high security risks.

So you should use dedicated libs like João advices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.