1

I'm trying to create a Python script that navigates to the Facebook marketplace and inputs the Min and Max price. I can't figure out how to fire the java script event to update the page with the items within the Min/Max price range. Any help would be appreciated

```
From selenium import webdriver
usr = "username"
pwd = "password"
driver = webdriver.Chrome(executable_path=r"C:\webdriver\chromedriver.exe")
driver.get('https://www.facebook.com')
username_box = driver.find_element_by_id('email') 
username_box.send_keys(usr) 
password_box = driver.find_element_by_id('pass') 
password_box.send_keys(pwd)
login_box = driver.find_element_by_id('loginbutton') 
login_box.click() 
driver.get('https://www.facebook.com/marketplace/toronto/vehicles/')
elem = driver.find_elements_by_class_name('_58al')
elem[0].send_keys("5000")
elem[1].send_keys("10000")
```
asked Apr 14, 2019 at 14:36
1
  • This can be done using page reloading, say every 1 minute. Or using ajax with a timer, to check periodically for updates, or websockets. Commented Apr 14, 2019 at 14:51

1 Answer 1

1

Instead of waiting for the event to trigger upon submitting your values, you could directly append your values to the URI and navigate with driver.get() knowing with confidence the page will display your results :)

https://www.facebook.com/marketplace/[randomints]/?minPrice=100&maxPrice=200

However, if you'd like to continue with submitting values you could consider using click() on the following class name _78o5 which at a glance, does seem to fire off the refresh event.

answered Apr 14, 2019 at 14:58
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.