有没有硒不起作用的网站? [英] Are there any sites where selenium doesn't work?

查看:19
本文介绍了有没有硒不起作用的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是住在韩国的韩国大学生.我通过翻译问这个问题,因为我周围没有人可以问.

I am a Korean college student living in Korea. I'm asking this question using a translator because there's no one around me to ask.

是否有不应用 selenium xpath 的站点?不应用语法find_element_by_xpath".设置另一个 xpath 或用名称或 ID 替换 xpath 时也是如此.

Is there a site where selenium xpath is not applied? Syntax 'find_element_by_xpath' is not applied. The same was true when setting another xpath or replacing xpath with a name or id.

它犯了一个错误,就好像它找不到 xpath 一样.

It makes an error as if it can't find the xpath.

更奇怪的是find_element_by_xpath"在其他网站上运行良好.我想知道为什么会发生这种现象.两天的实验.我没有犯任何错误.

What's even more strange is that 'find_element_by_xpath' worked fine on other sites. I wonder why this phenomenon is happening. Two days of experiments. I didn't make any mistakes.

推荐答案

我认为问题标题具有误导性,

I think question heading in misleading,

您可以使用 xpath 和 Selenium.

you can use xpath as well as Selenium.

唯一的问题是,它在 iframe 内.

only thing is, it is inside an iframe.

driver = webdriver.Chrome(driver_path)
driver.maximize_window()
driver.implicitly_wait(30)
driver.get("https://sugang.gwnu.ac.kr/")
wait = WebDriverWait(driver, 10)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, "Main")))
wait.until(EC.element_to_be_clickable((By.ID, "id"))).send_keys('your user name')

进口:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

这篇关于有没有硒不起作用的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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