本文将分享SeleniumWebDriver鼠标操作moveToElement不会在FirefoxLinux上引发mouseout事件的详细内容,并且还将对selenium移动鼠标进行详尽解释,此外,
本文将分享Selenium WebDriver鼠标操作moveToElement不会在Firefox Linux上引发mouseout事件的详细内容,并且还将对selenium移动鼠标进行详尽解释,此外,我们还将为大家带来关于Firefox + Selenium WebDriver并自动下载csv文件、Firefox-org.openqa.selenium.interactions.MoveTargetOutOfBoundsException、FireFox中的Selenium OpenQA.Selenium.DriverServiceNotFoundException、from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'的相关知识,希望对你有所帮助。
本文目录一览:- Selenium WebDriver鼠标操作moveToElement不会在Firefox Linux上引发mouseout事件(selenium移动鼠标)
- Firefox + Selenium WebDriver并自动下载csv文件
- Firefox-org.openqa.selenium.interactions.MoveTargetOutOfBoundsException
- FireFox中的Selenium OpenQA.Selenium.DriverServiceNotFoundException
- from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'
Selenium WebDriver鼠标操作moveToElement不会在Firefox Linux上引发mouseout事件(selenium移动鼠标)
我一直在尝试使用带有Firefox 19的Selenium WebDriver在我的网页中测试工具提示。
我基本上是在尝试使用鼠标动作将鼠标悬停在附加有工具提示的元素上,以测试工具提示的显示和悬停。在另一个元素上以测试工具提示是否隐藏。第一个操作工作正常,但是将鼠标悬停在另一个元素上时,工具提示仍然可见。手动测试网页时不会发生此问题。
有人遇到过这个问题吗?我正在使用Ubuntu 12.04。
答案1
小编典典看来Advanced Actions
API依赖于本机事件,默认情况下,Linux版本的Firefox中禁用了本机事件。因此,必须在WebDriver实例中显式启用它们。
FirefoxProfile profile = new FirefoxProfile();//explicitly enable native events(this is mandatory on Linux system, since they//are not enabled by defaultprofile.setEnableNativeEvents(true);WebDriver driver = new FirefoxDriver(profile);
- 另外,就我而言,我需要将WebDriver升级到2.31版,因为
moveToElement
即使显式启用了本机事件,hover()操作也无法在2.30上正常工作。在Linux上使用WebDriver的2.31版和Firefox的17和19版对此进行了测试。有关更多信息,您可以检查以下链接:http - //code.google.com/p/selenium/wiki/AdvancedUserInteractions#Native_events_versus_synthetic_events
Firefox + Selenium WebDriver并自动下载csv文件
如何解决Firefox + Selenium WebDriver并自动下载csv文件?
有时内容类型与您期望的不一样使用 Firefox插件(或类似工具)查找文件的真实内容类型并在代码中使用它
顺便说一句,对我来说,内容类型是
fp.set_preference("browser.helperApps.neverAsk.openFile", "application/octet-stream");
fp.set_preference("browser.helperApps.neverAsk.savetodisk", "application/octet-stream");
解决方法
我对Selenium WebDriver和Firefox有问题。我想在对话框窗口中下载没有确认的csv文件,并且我有如下代码:
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.dir",download_dir)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")
但似乎不起作用。我尝试了与 browser.helperApps.neverAsk.saveToDisk的* 许多组合 *
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv,application/csv,text/plan,text/comma-separated-values")
要么
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","application/csv")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/plain")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/comma-separated-values")
但没有任何区别,Firefox也不会自动下载。我该如何解决?
Firefox-org.openqa.selenium.interactions.MoveTargetOutOfBoundsException
我遇到了一个奇怪的情况,在“宁静”页面上,我必须滚动到该元素:
withAction().moveToElement(webElement).perform();
对于某些元素,此方法将抛出:
org.openqa.selenium.interactions.MoveTargetOutOfBoundsException:
(377.375,958.3999938964844) is out of bounds of viewport width (1268) and height (943)
它仅在Firefox中发生(Chrome可以正常运行)。而且,几乎所有其他我使用相同方法的地方都运行良好。所有元素只是按钮,输入字段等常用元素。
有人知道如何在Firefox中解决此问题吗?
我有:
- Firefox 61.0.2(64位)
- Windows 10
- 宁静1.9.30
- Geckodriver 0.21.0
FireFox中的Selenium OpenQA.Selenium.DriverServiceNotFoundException
我正在尝试开始编写Selenium测试,并且我编写的第一个非常基本的测试因exception失败OpenQA.Selenium.DriverServiceNotFoundException
。
using OpenQA.Selenium;using OpenQA.Selenium.Firefox;namespace WebDriverDemo{ class Program { static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); driver.Url = "http://www.google.com"; } }}
调试器说我需要下载geckodriver.exe并将其设置在我的PATH变量上,这已经完成,但仍然会出现相同的异常。当我对进行相同的操作时ChromeDriver
,效果很好。
同样,根据MDN,如果我使用的是Selenium
3.0或更高版本,则应默认启用它。我在Windows 10计算机上使用Selenium 3.0.1。
答案1
小编典典您可以使用System.setProperty()方法将geckodriver位置添加到PATH中,或仅将其添加到代码中。
看看下面的链接。它显示了Java中的基本代码,您需要编写等效的C#。但是它提到了使用GeckoDriver的步骤。如果仍然无法使用,请分享您得到的错误。
http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-
geckodriver/
from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'
如何解决from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named ''selenium''?
这是我的问题:当我运行 thos 脚本时,我的 cmd 向我返回一条错误消息,该消息与我的模块的导入有关。
导入脚本:
import logging
import os
import time
from lib2to3.pgen2 import driver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import webdriverwait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.firefox.webdriver import FirefoxProfile
from selenium.webdriver import ActionChains,DesiredCapabilities
# ================================ LOGGER ====================================
import pathlib
import platform
import shutil
import psutil
第一个 cmd 的消息是:
from selenium.webdriver.firefox.options import Options
ModuleNotFoundError: No module named ''selenium''
起初我认为这是我在安装 selenium 后安装的 FireFox 导航器的错误,但最后命令提示符给了我与 Chrome 相同的消息 :O ! 我检查了我的 Pyhton 的版本:“Python 3.9.2”。然后卸载selenium(已经安装了):
pip uninstall selenium
Found existing installation: selenium 3.141.0
Uninstalling selenium-3.141.0:
Would remove:
c:\users\w10cp\desktop\stage\venv\lib\site-packages\selenium-3.141.0.dist-info\*
c:\users\w10cp\desktop\stage\venv\lib\site-packages\selenium\*
Proceed (y/n)? y
Successfully uninstalled selenium-3.141.0
然后我再次安装它:
pip install selenium
Collecting selenium
Using cached selenium-3.141.0-py2.py3-none-any.whl (904 kB)
Requirement already satisfied: urllib3 in c:\users\w10cp\desktop\stage\venv\lib\site-packages (from selenium) (1.26.4)
Installing collected packages: selenium
Successfully installed selenium-3.141.0
但那是一样的:
from selenium.webdriver.firefox.options import Options
ModuleNotFoundError: No module named ''selenium''
所以我跑了
C:\Users\w10cp\Desktop\Stage>python
Python 3.9.2 (tags/v3.9.2:1a79785,Feb 19 2021,13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help","copyright","credits" or "license" for more information.
>>> import selenium
但没有任何变化
File "<stdin>",line 1,in <module>
ModuleNotFoundError: No module named ''selenium''
所以我继续使用 Stack OverFlow 寻找答案。 我成功卸载了 selenium 然后执行:
python -m pip install -U selenium
所以我再次运行我的脚本,结果如下:
from webdriver_manager.chrome import ChromeDriverManager
ModuleNotFoundError: No module named ''webdriver_manager''
所以我做了
pip install webdriver_manager
它已成功安装,但它返回相同的错误消息。 如果有人知道我必须做什么,请帮助我。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
今天关于Selenium WebDriver鼠标操作moveToElement不会在Firefox Linux上引发mouseout事件和selenium移动鼠标的讲解已经结束,谢谢您的阅读,如果想了解更多关于Firefox + Selenium WebDriver并自动下载csv文件、Firefox-org.openqa.selenium.interactions.MoveTargetOutOfBoundsException、FireFox中的Selenium OpenQA.Selenium.DriverServiceNotFoundException、from selenium.webdriver.firefox.options import Options ModuleNotFoundError: No module named 'selenium'的相关知识,请在本站搜索。
本文标签: