When I try to open a page with flash using an automated python script with Selenium I reach the page in the picture below. And I cannot pass.
It's a remote server running Ubuntu 16.04, without access to a monitor or a keyboard/mouse.
Python version: 3.5.2
Selenium version: 3.14.1
Geckodriver 0.26.0
Follows my code:
import pyvirtualdisplay
print ("pyvirtualdisplay Display Version: %s" % (pyvirtualdisplay.__version__))
from selenium import webdriver
print ("Selenium webdriver Version: %s" % (webdriver.__version__))
display = pyvirtualdisplay.Display(visible=0, size=(800, 600))
display.start()
profile = webdriver.FirefoxProfile()
profile.native_events_enabled = False
profile.set_preference("plugin.state.flash", 2)
profile.set_preference("dom.ipc.plugins.enabled.libflashplayer.so","true")
driver = webdriver.Firefox(profile)
driver.set_page_load_timeout(60)
url = 'https://www.ultrasounds.com/US.html'
driver.get(url)
driver.close()
driver.quit()
display.stop()
quit()
Here's the output:
Python 3.5.2 (default, Apr 16 2020, 17:47:17)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvirtualdisplay
>>> print ("pyvirtualdisplay Display Version: %s" % (pyvirtualdisplay.__version__))
pyvirtualdisplay Display Version: 0.2.4
>>> from selenium import webdriver
>>> print ("Selenium webdriver Version: %s" % (webdriver.__version__))
Selenium webdriver Version: 3.14.1
>>>
>>> display = pyvirtualdisplay.Display(visible=0, size=(800, 600))
>>> display.start()
<Display cmd_param=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '800x600x24', ':1001'] cmd=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '800x600x24', ':1001'] oserror=None return_code=None stdout="None" stderr="None" timeout_happened=False>
>>>
>>> profile = webdriver.FirefoxProfile()
>>> profile.native_events_enabled = False
>>> profile.set_preference("plugin.state.flash", 2)
>>> profile.set_preference("dom.ipc.plugins.enabled.libflashplayer.so","true")
>>> driver = webdriver.Firefox(profile)
>>> driver.set_page_load_timeout(60)
>>> url = 'https://www.ultrasounds.com/US.html'
>>> driver.get(url)
>>>
>>>
>>> import pyautogui
>>> im1 = pyautogui.screenshot('flash_activation_page.jpg')
>>> driver.close()
>>> driver.quit()
>>> display.stop()
<Display cmd_param=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '800x600x24', ':1001'] cmd=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '800x600x24', ':1001'] oserror=None return_code=0 stdout="" stderr="" timeout_happened=False>
>>>