i'm runnig this code.
from selenium import webdriver
driver = webdriver.Chrome("chromedriver.exe")
driver.implicitly_wait(1)
driver.get("https://www.vivaticket.com/it/search?categoryId=10&provinceCode=BO")
The open page is all lowercase "https://www.vivaticket.com/it/search?categoryid=10&provincecode=bo" and finds no results.
Do you have an idea how to deal with it? Thx for help
CodePudding user response:
I think you can bypass this using url-encoding:
def encode(string):
return "".join("%{0:0>2}".format(format(ord(char), "x")) for char in string)
province = "BO"
url = "https://www.vivaticket.com/it/search?categoryid=10&provincecode=" encode(province)
driver.get(url)
In your case, BO
stands for BO
.
CodePudding user response:
This is the site doing that on first browse for some reason. What I found that works is to just navigate twice.
String url = "https://www.vivaticket.com/it/search?categoryId=10&provinceCode=BO";
driver.get(url);
driver.get(url);
// proceed with your script
The second navigation keeps the proper capitalization.