03-03-2019, 12:45 PM
Code:
#!/usr/bin/python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('no-sandbox') # so it can be run as root
driver = webdriver.Chrome(chrome_options=options)
driver.get('http://moode.local')
#a = driver.find_element_by_id("play")
b = driver.find_element_by_id("random")
#a.click()
b.click()
driver.close()
So this code is a really inefficient way of getting close to what I described. This will 'click' on the 'random' button on the web interface from a (headless) remote machine. It uses Selenium and Chromium / chromedriver to run the web page in the background so things can be interacted with.
I've taken this and incorporated in to my GPIO button interface code - and so far works as I had hoped allowing me to go from a radio stream to random play (using ashuffle) and back again. Happy to share that code if people are interested.
T