我正在使用Selenim Java.我需要在文本框中输入值,然后按向下箭头以选择sugesstions,然后按enter按钮.
所以,我的问题是如何按下向下箭头键,然后按"回车"按钮?
如前所述,有没有办法发送全局ESC密钥来关闭弹出窗口(CSS MODAL窗口)?我试过以下但没有奏效:
driver.find_element_by_tag_name('body').send_keys(Keys.ESCAPE)
我知道我可以使用xPath等但问题是网站有动态elementIds和类名.
我正在使用Selenium WebDriver和Ruby进行自动化测试.我需要点击一个按钮.由于按钮是透明的,我无法通过id或css或xpath获取按钮元素.我想使用Tab和Enter键按下按钮.
我可以使用Tab键获取如下按钮:
@element.send_keys :tab
@element --> any javascript element visible in the browser
Run Code Online (Sandbox Code Playgroud)
但是如何使用按钮上的Enter键?
基本上我需要按Tab键,然后按Enter键单击按钮.
我正在使用Selenium WebDriver @driver = Selenium::WebDriver.for :firefox
我正在尝试使用nunit + Selenium + c#创建自动化框架
我们的webadmin基于Devexpress框架,因此我不能点击它的"ID"按钮或至少我不知道如何.对此的替代只需按"Enter"按钮即可.我已经尝试过了
driver.FindElement(By.XPath("String")).SendKeys(Keys.Enter);
Run Code Online (Sandbox Code Playgroud) Selenium 中的回车键和回车键有什么区别?这个相关的 SO 答案和提供的链接表明它们是不同的。我还注意到,在使用 Firefox 24.2 时,回车键将发送一个 HTML 表单,而返回则不会。
如何使用C#使用Selenium RC按Enter键?
我正在SearchBox使用Selenium。我必须在其中键入一些名称,并且必须按Enter进行搜索。
没有Submit按钮。因此,我必须使用Enter。
我尝试过这样的事情
selenium.KeyPress("quicksearchtextcriteria", "13");
Run Code Online (Sandbox Code Playgroud)
但是不起作用。
请帮忙。
注意:我收集了执行此操作的可能方法的集合。参见此处:按Enter键输入硒
如何使用selenium python绑定模拟ENTER键按下?我尝试了下面的块,但它不起作用.
driver.find_element_by_xpath("html/xxxxx").send_keys('keys.ENTER')
Run Code Online (Sandbox Code Playgroud)
要么
driver.find_element_by_name("element_name").send_keys("ENTER")
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Eclipse 中使用 WebDriver、TestNG 编写测试用例。WebDriver 版本为 2.39
在测试用例中,我试图打开浏览器,输入站点地址,加载后,找到搜索字段,使用 Excel 工作表中的数据驱动类型输入文本。
输入第一个数据后,我想单击键盘上的 Return 键并等待加载并清除它并从电子表格输入下一个测试。
我成功输入文本,清除,但不知道如何编写代码以按“回车键”或回车,请指教。
抱歉,我在搜索中找不到这个。
问候,
我想在 Instagram 中搜索一个特殊的关键字。例如,我想搜索这个词:“快餐”。我可以在搜索框中发送此密钥。但是,当我通过 Python3 在 Selenium 中使用 submit 方法时,它不起作用并给我错误。这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
import time
driver = webdriver.Firefox()
url="https://www.instagram.com/p/pTPI-kyX7g/?tagged=resurant"
driver.get(url)
#login_button=driver.find_element_by_xpath("""/html/body/span/section/main/article/div[2]/div[2]/p/a""")
#login_button.click()
import time
driver.implicitly_wait(5)
search_button=driver.find_element_by_xpath("""/html/body/span/section/nav/div[2]/div/div/div[2]/input""")
search_button.send_keys("fast food")
search_button.submit()
Run Code Online (Sandbox Code Playgroud)
这是错误的:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: ./ancestor-or-self::form
Run Code Online (Sandbox Code Playgroud)
你可以帮帮我吗?
我通过pip在windows机器上安装了selenium.
只需在网站上试用样本:
http://pypi.python.org/pypi/selenium
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://www.yahoo.com") # Load page
assert browser.title == "Yahoo!"
elem = browser.find_element_by_name("p") # Find the query box
elem.send_keys("selenium" + Keys.RETURN)
time.sleep(0.2) # Let the page load, will be added to the API
try:
browser.find_element_by_xpath("//a[contains(@href,'http://seleniumhq.org')]")
except NoSuchElementException:
assert 0, "can't find seleniumhq"
browser.close()
Run Code Online (Sandbox Code Playgroud)
我从时间变为导入时间,它给出的错误消失了,现在我得到了:
Traceback (most recent call last):
File "test.py", line 3, in module
from …Run Code Online (Sandbox Code Playgroud) 如何在Selenium WebDriver中同时执行Ctrl+ Enter↵?我试过这个:
body1.sendKeys(Keys.CONTROL + "ENTER");
Run Code Online (Sandbox Code Playgroud)
但它不起作用.