简体   繁体   English

硒中未触发Javascript框

[英]Javascript box not being triggered in selenium

I'm currently trying to automate part of our web application, mainly a form of @mentioning similar to facebook. 我目前正在尝试自动化我们的Web应用程序的一部分,主要是类似于Facebook的@mentioning形式。 In the front end when a user types @ into a text input the API calls the list of users and displays them in a box that appears. 在前端,当用户在文本输入中输入@时,API会调用用户列表并将其显示在出现的框中。 This element is currently at the end of the DOM and not visible until the javascript triggers when the @ is typed. 该元素当前位于DOM的末尾,直到键入@时javascript触发后才可见。

My selenium code uses send_keys to populate the @namehere but the user window element doesn't appear, even if i do it manually while the browser is opened via selenium 我的硒代码使用send_keys在此处填充@name,但没有显示用户窗口元素,即使我在通过selenium打开浏览器时手动进行操作也是如此

I've tried using the upkey event from Action Chains, injecting javascript to trigger the event, clicking back onto the text input to make sure its focused but nothing works. 我尝试使用Action Chains中的upkey事件,注入javascript触发事件,单击返回到文本输入以确保其焦点集中,但没有任何效果。 This happens in both chrome and firefox chrome和Firefox中都会发生这种情况

Literally searched everywhere, any ideas? 从字面上搜索,有什么想法吗?

Feature step: 功能步骤:

And i create a post titled "@James"

implementation: 执行:

@when('i create a post titled "([^"]*)"')
    def step_impl(context, text):
    page = ActivityStreamPage.NewPost(context)
    page.post_input.click()
    page.post_input.send_keys(text)

element: 元件:

'post_input': (By.CLASS_NAME, "js-post-textarea")

web element: 网络元素:

<div class="js-post-textarea js-edit-content editor__editable" 
contenteditable="true" autocomplete="off" autocorrect="off" 
autocapitalize="off" placeholder="Write a post or @mention to notify 
someone"><span class="atwho-query">@</span><br></div>

user box: 用户框:

<div class="atwho-view" id="at-view-64" style="display: none; top: 
    135px; left: 440px;">
    <ul class="atwho-view-ul">
        <li class="mention__item cur">
            <p class="mention__notice">
                <span>@Group</span>
                "Notify everyone in this Group."
            </p>    
        </li>
    </ul>
</div>

after a lot of debugging, seems that the AJAX call was being refused due to permissions. 经过大量调试后,似乎AJAX调用由于权限被拒绝。 a defect with the application rather than selenium. 应用程序而不是硒的缺陷。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM