Click here to Skip to main content
14,735,933 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Trying to build a small bot to help with trading but for some reason the code gets an array of slightly different errors when trying to search for a instrument.

All i want it to do is click on the first instrument that comes up when you type something into the search bar ...the problem i think is the fact that there are multiple different search returns with no way to tell the difference between them so it is difficult to find the correct one

self.driver = webdriver.Chrome()
         self.driver.get("https://app.libertex.com/")
         self.driver.find_element(By.XPATH, "//input[@value=\'\']").click()
         self.driver.find_element(By.CSS_SELECTOR, ".active > input:nth-child(2)").send_keys("Bitcoin")
         self.driver.find_element(By.PARTIAL_LINK_TEXT, ".search-match")[1].click()  # *tried doing CSS_Selector and the Xpaths ,xpath=//input  ,xpath=//header[@id='region-header']/div/div/div[3]/input  each giving different errors
#.new-invest-btn



Tried mimicking key pressing and all x paths and css paths

What I have tried:

Tried mimicking key pressing and all x paths and css paths Nothing seems to be working ... it just either cant find the first search return to click on or is just unable to click on it
I get errors such as
illegalselector was specified or could not find xpath

no such element: Unable to locate element: {"method":"partial link text","selector":".search-match"}

and sometimes the webdriver just closes instantly after running ..even if i put breakpoints in the code.

Its weird because the Selenium IDE version works absolutely fine but when i bring it into python it decides it doesnt want to.


install command for selenium is
pip install selenium (cmd)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900