尝试在Selenium中为Python使用Select中的SyntaxError [英] SyntaxError trying to use Select in Selenium for python

查看:77
本文介绍了尝试在Selenium中为Python使用Select中的SyntaxError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码的相关行:

Here are the relevant lines of my code:

from selenium.webdriver.support.ui import Select
select = Select(browser.find_element_by_name("TimecardPeriodList")
select.select_by_index(5)

我在最后一行收到一条无效的语法错误消息,箭头指向第一个选择"中的"t". (这是我的第一篇文章,所以我现在还不能附加图片).

I'm receiving an Invalid Syntax error message on the last line, with the arrow pointing at the "t" in the first "select". (this is my first post so I can't attach images yet).

基于我在硒中使用select的线程,我正确地做到了.

Based on the threads I've seen for using select in selenium, I'm doing this correctly.

推荐答案

代码缺少右括号.

select = Select(browser.find_element_by_name("TimecardPeriodList"))
                                                                  ^

这篇关于尝试在Selenium中为Python使用Select中的SyntaxError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆