Jacobvu84 / selenium-vietnam-training-course

Questions Tracking
7 stars 5 forks source link

Workaround - Some websites have bot detection to prevent webdriver #56

Open hienphan-evizi opened 5 years ago

hienphan-evizi commented 5 years ago

I've been testing out Selenium with Chromedriver and I noticed that some pages can detect that you're using Selenium. In this post, I will take "https://www.etihadholidays.com/en-ot/" as an example.

screen shot 2019-01-23 at 9 36 55 am

The page will throw the "Access Denied, You don’t have permission to access" error when you try to click "Search Packages" button when finding a fly using chromedriver

screen shot 2019-01-23 at 9 32 23 am

I've detected that they have an odd cookie to prevent the action (as mention in https://www.thewindowsclub.com/access-denied-dont-permission-access-server)

screen shot 2019-01-22 at 4 46 37 pm

All we need to do is to delete all of cookies before clicking to Search Packages button. Here is the example code in python (just hard code to select departure/arrival value)

https://paste.ofcode.org/CS724wNeaVcK2rEDWHxSUU

Refer url: