selenium

How can I run Selenium tests in a docker container with a visible browser?

六眼飞鱼酱① 提交于 2021-02-02 08:26:02
问题 If I want to run Selenium tests inside a Docker container with a visible (not headless) browser, what are my options? Do I need to use a remote display viewer such as VNC? Is it possible to use a browser on the host? (I.e. a browser that is not in the Docker container). How does this work? Any other option? 回答1: Docker Docker is a software containership platform that provides virtualization from the os. In Docker, all software parts are organised as containers which includes the operating

【java+selenium3】JavaScript的调用执行 (十)

北城余情 提交于 2021-02-02 04:59:49
JavaScript的调用   在web自动化操作页面的时候,有些特殊的情况selenium的api无法完成,需要通过执行一段js来实现的DOM操作; // 执行方式 JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript( "js代码"); 例如: 1.时间插件限制手动输入的情况下,sendkeys无法写入数据,需要执行js来移除readonly属性! 详细参考博客: 时间控件的处理 2.有些页面元素需要拉动滚动条才能获取到(因为拉取滚动条才加载),而selenium和webdriver都没有提供操作滚动条的方法,只能借助js来完成! // 执行方式 JavascriptExecutor jsExecutor = (JavascriptExecutor) driver; String js = "document.body.scrollTop=200" ; jsExecutor.executeScript(js); // 执行js 兴趣扩展:实现滚动条匀速向下滚动代码 package cn.test; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver

企业网站测试流程有哪些步骤?

最后都变了- 提交于 2021-02-02 04:07:29
顾翔老师的《软件测试技术实战设计、工具及管理》网上购买地址: https://item.jd.com/34295655089.html 《基于Django的电子商务网站》网上购买地址: https://item.jd.com/12082665.html 店铺二维码: 来源:https://www.testwo.com 企业网站搭建好之后,为了更好的适应网络环境和平台环境,免不了要进行网站测试。比如说,如果网站上线后,在现有的浏览器或者说网络环境中出现页面乱码,报错等问题,网站测试的目的就是为了帮助帮助企业更好的发现网站上线后可能存在的问题并及时进行修复处理。 那么对于开发人员或者测试人员来说,企业网站测试流程一般都包含哪些工作要做,具体步骤又是如何呢?卓码测评小编通过简单的网站测试报告模板范文进行梳理,帮助大家更好的完善企业网站测试工作。 一、 企业网站测试内容有哪些? 企业网站初期框架搭建完成以后,一般需要进行全面的测试才能正式上线。具体企业网站测试内容有以下: 1、网站 性能测试 ;对服务器的安全性、稳定性测试,连接速度、压力测试等。 2、页面测试;主要是页面显示、页面结构,链接等是否工作正常。 3、兼容性测试;网站对于不同浏览器版本的兼容性测试等。 4、安全测试;网站登录,密码保护、信息完整性等测试。 5、代码合法性测试;包括程序代码合法性检查与显示代码合法性检查 二、

find_element_by_class_name in selenium giving error

北战南征 提交于 2021-02-02 03:49:49
问题 I am trying to automate a button click using selenium but it is giving me the error. The html code of the page is: The code i am trying is: create_team=driver.find_element_by_class_name('ts-btn ts-btn-fluent ts-btn-fluent-secondary ts-btn-fluent-with-icon join-team-button') create_team.click() I am getting the following error: 回答1: driver.find_element_by_class_name() only accepts one className, it's not built to handle multiple classNames, reference - (How to locate an element with multiple

find_element_by_class_name in selenium giving error

风流意气都作罢 提交于 2021-02-02 03:47:33
问题 I am trying to automate a button click using selenium but it is giving me the error. The html code of the page is: The code i am trying is: create_team=driver.find_element_by_class_name('ts-btn ts-btn-fluent ts-btn-fluent-secondary ts-btn-fluent-with-icon join-team-button') create_team.click() I am getting the following error: 回答1: driver.find_element_by_class_name() only accepts one className, it's not built to handle multiple classNames, reference - (How to locate an element with multiple

find_element_by_class_name in selenium giving error

半腔热情 提交于 2021-02-02 03:47:07
问题 I am trying to automate a button click using selenium but it is giving me the error. The html code of the page is: The code i am trying is: create_team=driver.find_element_by_class_name('ts-btn ts-btn-fluent ts-btn-fluent-secondary ts-btn-fluent-with-icon join-team-button') create_team.click() I am getting the following error: 回答1: driver.find_element_by_class_name() only accepts one className, it's not built to handle multiple classNames, reference - (How to locate an element with multiple

How to perform multiple actions and click on the link with text as Member Login on the url http://www.spicejet.com/ through selenium-webdriver

寵の児 提交于 2021-02-02 03:46:47
问题 I tried the below code but it is not mouse hovering and clicking on 'Member login' WebElement lgn = driver.findElement(By.id("ctl00_HyperLinkLogin")); WebElement ssm = driver.findElement(By.xpath("//a[contains(text(), 'SpiceCash/SpiceClub Members')]")); WebElement cgm = driver.findElement(By.xpath("//a[contains(text(),'Member Login')]")); Actions a1 = new Actions(driver); a1.moveToElement(lgn).moveToElement(ssm).moveToElement(cgm).click().build().perform(); 回答1: To invoke click() on the

Chrome DevTools not find elements not search

醉酒当歌 提交于 2021-02-02 03:44:39
问题 I am using selenium for chrome automation. for a while now the DevTool of chrome (F12) not working as expcted. (Version 84.0.4147.89 (Official Build) (64-bit)) When I try to locate element it is not find it even the element exists. Even when I press ctrl + f and search for a big word it is not find it. I need the dev tool since it is mark where the element, and where I am standing. Is their any soloution? I provide two pics: in one it's find and marked the value, and after I add the letter 'c

Selenium Webdriver can't access a website (The requested URL was rejected)

≯℡__Kan透↙ 提交于 2021-02-02 03:44:34
问题 I did several hours of research and asked a bunch of people on fiverr who all couldn't solve a a specific problem I have. I installed Selenium and tried to access a Website. Unfortunately the site won't allow a specific request and doesn't load the site at all. However, if I try to access the website with my "normal" Chrome Browser, it works fine. I tried several things such as: Different IP's Deleting Cookies Incognito Mode Adding different UserAgents Hiding features which might reveal that

How to initiate Chrome Canary in headless mode through Selenium and Python

若如初见. 提交于 2021-02-02 03:43:50
问题 from selenium import webdriver options = webdriver.ChromeOptions() options.binary_location = 'C:\Users\mpmccurdy\Desktop\Google Chrome Canary.lnk' options.add_argument('headless') options.add_argument('window-size=1200x600') driver = webdriver.Chrome(chrome_options=options) driver.get("https://www.python.org") 回答1: If you are using Chrome Canary as a basic Requirement the server still expects you to have Chrome installed in the default location as per the underlying OS architecture as follows