简体   繁体   English

当我使用功能时,请在Chrome控制台上单击以获取未定义

[英]When I used function click on the chrome console I get undefined

I am using a xpath trying to click but I get undefined. 我正在使用xpath尝试单击,但未定义。

$x('//*[@id="form-container"]/ul/li[8]/div/div[2]/a')[0].click();

You can click manually is there any other way that I can click on the console and I tried $x('//*[@id="form-container"]/ul/li[8]/div/div[2]/a').click() but does not work. 您可以手动单击,还有其他方法可以单击控制台,然后尝试了$x('//*[@id="form-container"]/ul/li[8]/div/div[2]/a').click()但不起作用。

You can create a click event and dispatch it on a html element 您可以创建click 事件并将其分派到html元素上

 var evt = new Event("click", {"bubbles":true}); document.addEventListener("click",e=>console.log("clicked",e)); document.dispatchEvent(evt); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Console.log() 有一个值,但是当我将它与 map 函数一起使用时,它变得未定义 [ReactJS] - Console.log() has a value but when I used it with map function it became undefined [ReactJS] 尝试从Chrome扩展程序而不是从开发人员控制台访问gmail中的iframe时出现未定义错误 - I get undefined error when trying to access iframes in gmail from my chrome extension but not from the developer console 使用Chrome控制台时,如何从jQuery范围中获取匿名函数中的变量? - How can i get a variable in anonymous function from jQuery scope when I use chrome console? 为什么我在chrome中遇到未定义函数的错误? - Why do I get an error of undefined function in chrome? 我对此 function 未定义 - I get undefined for this function 当我尝试在函数中添加一些结果时,为什么 console.log 打印到控制台“未定义”? - Why the console.log prints to the console "undefined" when I try to add some results in the function? 当我单击计算器键时,它有时会随机 console.logs “undefined” - When i click a calculator key, it sometimes randomly console.logs "undefined" 为什么当我在console.log(createdAnimal)中得到未定义时? - Why when I get undefined when I console.log(createdAnimal)? 我的错误控制台中出现未定义的错误 - I get an undefined error in my error console 为什么我在JavaScript的控制台中无法定义 - why do i get undefined in the console in JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM