Trying to make Driver.get() work for multiple different URL's but that seems to be impossible as .get has to contain a string , it can not contain a variable that is a string and neither can you convert it to a string in the process.
driver1 = webdriver.Chrome()
TradeURL1 = "https://app.libertex.com/products/crypto/Bitcoin/" #User stated
#driver1.execute_script(driver1.get(str(TradeURL1)))
driver1.get(TradeURL1)#https://app.libertex.com/products/metal/XAUUSD
declaring the URL as a variable and placing the variable name in the .get throws the script must be a string error .
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: 'script' must be a string
but placing the URL in like this
driver1.get("https://app.libertex.com/products/metal/XAUUSD")
works perfectly fine . how are you supposed to make your code versatile and adapt it if you cant place a variable name there(the URL is changing throughout the code) Is there a way around this other than using multiple drivers (because i will not even know how many drivers i will be using + using multiple drivers takes more processing power and is inefficient)
similar question enter link description here
edit after @DeepSpace
driver1 = webdriver.Chrome()
TradeURL1 = "https://app.libertex.com/products/crypto/Bitcoin/" #User stated
#driver1.execute_script(driver1.get(str(TradeURL1)))
driver1.get(TradeURL1)#https://app.libertex.com/products/metal/XAUUSD
time.sleep(5)
driver1 = login()
the driver1 = login() login() is a subroutine i have built, when i run the code(works for when you actually put a string in get) it works fine. But when running with driver1.get(TradeURL1) shows this error
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#login-field"}
backtracking what i had done up to that point ..changing driver1.get("Actual string") to driver1.get(TradeURL1) and sure enough the issue was the script must be a string error ... im confusedas you are @DeepSpace