Home > Software design >  Hello, In pyhton, the xpath of the button is not correct, it gives an error
Hello, In pyhton, the xpath of the button is not correct, it gives an error

Time:08-24

What could I be missing?

mınPrice = driver.find_element("xpath","/html/body/div[3]/div[1]/div[3]/div[4]/div[1]/div[1]/div/form/fieldset[1]/div[1]/div[2]/div/div[1]/div/div[1]/input").send_keys("500") 
maxPrice = driver.find_element("xpath","/html/body/div[3]/div[1]/div[3]/div[4]/div[1]/div[1]/div/form/fieldset[1]/div[1]/div[2]/div/div[2]/div/div[1]/input").send_keys("90000") 
time.sleep(1) 
entered_button=driver.find_element(By.ID,"//*[@id="minisearch-search-btn"]") 
entered_button.click() 
time.sleep(1)

CodePudding user response:

You should be able to find that button with:

entered_button=driver.find_element(By.XPATH,"//*[@id='minisearch-search-btn']") 

CodePudding user response:

No, unfortunately. But I changed it like this.

entered_button=driver.find_element(By.CSS_SELECTOR,"#minisearch-search-btn")

I replaced xpath with selector.

  • Related