element = driver.execute_script("""
return document.elementFromPoint(arguments[0], arguments[1]);
""", x, y)
这假设x和{}被设置为整数值。在JavaScript端,在第一个参数之后传递给execute_script的参数变成arguments[0], arguments[1]等。(这就是老好人^{} object。Selenium将您提供给execute_script的JavaScript代码包装在一个函数中。)如果找不到任何内容,element将是{}的实例,或者是{}。根据MDN page on this function值,如果:
If the specified point is outside the visible bounds of the document or either coordinate is negative, the result is null.
您必须使用JavaScript:
这假设}被设置为整数值。在JavaScript端,在第一个参数之后传递给} object 。Selenium将您提供给}的实例,或者是{}。根据MDN page on this function值,如果:
x
和{execute_script
的参数变成arguments[0], arguments[1]
等。(这就是老好人^{execute_script
的JavaScript代码包装在一个函数中。)如果找不到任何内容,element
将是{JavaScript}。在
null
在Python中变成{相关问题 更多 >
编程相关推荐