实习生实习协议

    技术2022-07-11  143

    实习生实习协议

    You know how you can't remember something your spouse feels is really important but you can remember every funny line from that movie you saw when you were 17?  That's how I feel after months of writing selenium tests using the Intern framework -- I've forgotten lots of important front-end stuff but I've uncovered loads of selenium issues and techniques to hack around them.

    您知道自己不记得自己配偶觉得很重要的事情,但是可以记得17岁那年看的那部电影中的每条有趣的台词吗? 在使用Intern框架编写Selenium测试几个月后,我的感觉就是这样-我忘记了很多重要的前端内容,但是我发现了很多Selenium问题和解决它们的技术。

    I initially wrote my tests using Firefox as the test browser.  Then I opened up my testing to Chrome and needed to adjust a whole bunch of stuff because Chrome doesn't reliably do things like Firefox, like element `click` vs. `enter` key press.  And don't ask me about concurrency issues.  Then today I had the bright idea of adding Safari to the mix.  In a word....f*ck.  A whole new world of issues cropped up.

    我最初使用Firefox作为测试浏览器来编写测试。 然后我打开了对Chrome的测试,并需要调整很多东西,因为Chrome无法可靠地执行Firefox之类的操作,例如元素click和vsenter键。 而且不要问我有关并发问题 。 然后,今天我有了一个聪明的主意,将Safari添加到其中。 一句话.... f * ck。 出现了一个全新的问题世界。

    One issue that Selenium + Safari has (one of dozens) is history / URL issues.  After doing loads of research and implementing every hack I could think of, I had this moment:

    Selenium + Safari存在的一个问题(数十个问题之一)是历史/ URL问题。 经过大量的研究并实现了我能想到的所有技巧之后,我有了这一刻:

    If there's a Selenium issue in a given browser that makes it impossible for a test to complete properly, there's no point in fighting it -- this case calls for simply passing the test instead of dealing with the annoyance of seeing a failure due to Selenium error.   But how do you get browser information within a test?

    如果给定的浏览器中存在Selenium问题,导致无法正常完成测试,则没有任何必要进行斗争-这种情况要求简单地通过测试,而不是因为看到因Selenium错误而导致失败的烦恼。 但是如何在测试中获取浏览器信息?

    // From within a test function console.log(this.remote.session.capabilities); { 'webdriver.remote.sessionid': 'f4dffffc-8d40-4e21-a862-459109ffabfc', browserName: 'safari', takesScreenshot: true, javascriptEnabled: true, version: '8.0.8', cssSelectorsEnabled: true, platform: 'MAC', secureSsl: true, remoteFiles: true, nativeEvents: false, rotatable: false, locationContextEnabled: false, webStorageEnabled: false, applicationCacheEnabled: false, supportsNavigationDataUris: true, supportsCssTransforms: true, supportsExecuteAsync: true, mouseEnabled: true, touchEnabled: false, dynamicViewport: true, shortcutKey: '', brokenDeleteCookie: false, brokenExecuteElementReturn: false, brokenExecuteUndefinedReturn: false, brokenElementDisplayedOpacity: false, brokenElementDisplayedOffscreen: false, brokenSubmitElement: true, brokenWindowSwitch: true, brokenDoubleClick: false, brokenCssTransformedSize: true, fixedLogTypes: false, brokenHtmlTagName: false, brokenNullGetSpecAttribute: false, brokenNavigation: true, brokenMouseEvents: true, brokenWindowPosition: true, brokenSendKeys: true, brokenCookies: true }

    The session object on the remote provides information about the browser session, including the name (most important) as well as fixes provided by Intern.

    远程服务器上的会话对象提供有关浏览器会话的信息,包括名称(最重要)以及Intern提供的修复程序。

    In an ideal world you can write all of your Selenium tests in one format and it works within each browser....but we don't live in an ideal world, the same way we need browser hacks within our client side JavaScript.  Being able to get browser name and other information within a test, however, is just another super useful bit of information exposed by Intern!

    在理想的世界中,您可以用一种格式编写所有Selenium测试,并且它可以在每种浏览器中运行....但是我们并非生活在理想的世界中,就像我们需要在客户端JavaScript中使用浏览器黑客一样。 但是,能够在测试中获取浏览器名称和其他信息,只是Intern公开的另一种超级有用的信息!

    翻译自: https://davidwalsh.name/browser-name-intern

    实习生实习协议

    Processed: 0.016, SQL: 9