2021年11月23日

selenium.common.exceptions.JavascriptException : Message: TypeError: document.querySelector(...) is null

摘要: 很大原因是页面还未加载完全,需添加等待时间 阅读全文

posted @ 2021-11-23 16:28 苦海舟 阅读(330) 评论(0) 推荐(0)

python 折行 无空格

摘要: >>> line = (... "this is a"... "very very"... "long string")>>> print(line)this is avery verylong string 阅读全文

posted @ 2021-11-23 16:27 苦海舟 阅读(39) 评论(0) 推荐(0)

2021年11月20日

selenium 切换窗口 current_url获取的地址并非切换后的窗口地址

摘要: 问题:打开当前页面--1,点击按钮后重新打开窗口--2,此时执行current_url,获取到的url为窗口1的url 解决方法: switch_to.window(窗口2句柄),然后再执行current_url,就可获取窗口2的url 阅读全文

posted @ 2021-11-20 17:32 苦海舟 阅读(626) 评论(0) 推荐(0)

2021年11月16日

switch_to.active_element 获取焦点元素

摘要: https://blog.csdn.net/huilan_same/article/details/52338073 阅读全文

posted @ 2021-11-16 16:13 苦海舟 阅读(112) 评论(0) 推荐(0)

js 向iframe里的富文本框输入内容

摘要: https://exmail.qq.com document.querySelector('iframe#mainFrame').contentWindow.document.getElementsByClassName('QMEditorIfrmEditArea')[0].contentDocum 阅读全文

posted @ 2021-11-16 14:12 苦海舟 阅读(387) 评论(0) 推荐(0)

selenium 富文本框 send_keys 页面无内容

摘要: 在qq企业邮箱中定位编写邮件页面的正文输入框,并向其中输入内容,定位语句(已定位到body标签)与最后的send_keys都正常执行,无报错内容,但实际页面始终没有信息输入。 后来使用js语句完成输入操作:document.querySelector('body').innerText='123'; 阅读全文

posted @ 2021-11-16 14:01 苦海舟 阅读(165) 评论(0) 推荐(0)

selenium.common.exceptions.JavascriptException: Message: SyntaxError: unexpected token: identifier

摘要: 初始: string = ‘abc’ js = f"document.querySelector('body').innerText={string}"driver.execute_script(js) 执行报错: selenium.common.exceptions.JavascriptExcep 阅读全文

posted @ 2021-11-16 13:55 苦海舟 阅读(537) 评论(0) 推荐(0)

2021年11月15日

selenium.common.exceptions.InvalidElementStateException: Message: Unable to clear element that cannot be edited: <td class="content_title">

摘要: 输入框,元素定位未定位到input标签 阅读全文

posted @ 2021-11-15 16:30 苦海舟 阅读(345) 评论(0) 推荐(0)

2021年11月14日

css_selector and or

摘要: 选择元素X的属性a和b: X[a][b] 选择元素X的属性a或b X[a],X[b] 阅读全文

posted @ 2021-11-14 16:14 苦海舟 阅读(149) 评论(0) 推荐(0)

2021年10月3日

多层装饰器

摘要: 1 def decorate1(func1): 2 def wrapper1(): 3 print(f'wrapper1 >{wrapper1}') 4 print(' decorate1 start ') 5 print(f'func1 >{func1}') 6 func1() 7 print(' 阅读全文

posted @ 2021-10-03 20:42 苦海舟 阅读(31) 评论(0) 推荐(0)

导航