2026年知到答案 Python自动化测试 最新知到智慧树满分章节测试答案

2026年1月8日 分类:网课答案 作者:站长

第一章 单元测试

1、 问题:自动化测试适用于哪种项目?( )
选项:
A:需求频繁变动的项目。
B:界面不稳定的项目。
C:周期短的项目。
D:需求变动不频繁的项目。
答案: 【
需求变动不频繁的项目。

2、 问题:Python自动化测试的主要优势是什么? ( )
选项:
A:支持图形化界面操作
B:仅能与特定浏览器兼容
C:简单易学、跨平台、高效、可扩展
D:需要大量硬件资源支持
答案: 【
简单易学、跨平台、高效、可扩展

3、 问题:以下哪个是Python自动化测试的典型应用场景? ( )
选项:
A:网络流量分析
B:Web应用程序功能验证与回归测试
C:图像处理
D:文件压缩与解压缩
答案: 【
Web应用程序功能验证与回归测试

4、 问题:Python作为自动化测试工具的主要优势是什么? ( )
选项:
A:需要大量内存和高性能硬件支持
B:只支持Windows操作系统
C:语法简洁,支持跨平台,易于集成和扩展
D:仅能用于Web应用测试
答案: 【
语法简洁,支持跨平台,易于集成和扩展

5、 问题:下列哪个是自动化测试的主要目的?( )
选项:
A:减少测试成本和时间。
B:完全避免软件缺陷。
C:替代开发人员的工作。
D:提高软件的美观性。
答案: 【
减少测试成本和时间。

6、 问题:不是自动化测试的优势的是 ( )
选项:
A:提高软件测试的质量
B:提高测试效率,缩短测试工作时间
C:更好地重现软件缺陷的能力
D:取代手工测试
答案: 【
取代手工测试

7、 问题:浏览器驱动配置不正确的是 ( )
选项:
A:将驱动文件所在路径添加到环境变量中
B:将其放置在Python安装目录中
C:将其放置在Python安装目录中的scripts文件夹中
D:将驱动任意放置且无法获取驱动路径
答案: 【
将驱动任意放置且无法获取驱动路径

8、 问题:如果需要更新Selenium到最新版本,应该使用哪个命令? ( )
选项:
A:pip remove selenium
B:pip uninstall selenium
C:pip show selenium
D:pip install –upgrade selenium
答案: 【
pip install –upgrade selenium

9、 问题:Selenium支持哪些编程语言? ( )
选项:
A:仅支持Python
B:多种语言,包括Java、Python、C#等
C:仅支持Java和C#
D:仅支持JavaScript
答案: 【
多种语言,包括Java、Python、C#等

10、 问题:Selenium支持哪些浏览器进行自动化测试? ( )
选项:
A:Chrome、Firefox、Safari、Edge、Internet Explorer等
B:仅支持Chrome和Firefox
C:仅支持Chrome和Safari
D:仅支持Chrome和Edge
答案: 【
Chrome、Firefox、Safari、Edge、Internet Explorer等

11、 问题:在Python自动化测试中,以下哪个库主要用于控制浏览器进行Web自动化测试?( )
选项:
A:NumPy
B:Selenium
C:Pandas
D:Matplotlib
答案: 【
Selenium

12、 问题:谷歌浏览器驱动的名称是 ( )
选项:
A:firefoxdriver
B:geckodriver
C:IEDriverServer
D:Chromedriver
答案: 【
Chromedriver

13、 问题:IE浏览器驱动的名称是 ( )
选项:
A:firefoxdriver
B:geckodriver
C:IEDriverServer
D:Chromedriver
答案: 【
IEDriverServer

14、 问题:可用来启动搜狗浏览器的驱动是 ( )
选项:
A:firefoxdriver
B:geckodriver
C:IEDriverServer
D:Chromedriver
答案: 【
Chromedriver

15、 问题:基于 Chromium内核 的 Edge 浏览器的驱动是 ( )
选项:
A:IEDriverServer
B:MicrosoftWebDriver.exe
C:msedgedriver.exe
D:Chromedriver
答案: 【
msedgedriver.exe

16、 问题:启动Edge浏览器时,可以使用IE浏览器驱动IEDriverServer。 ( )
选项:
A:对
B:错
答案: 【

17、 问题:启动QQ浏览器时,可以使用Chrome浏览器驱动Chromedriver。 ( )
选项:
A:对
B:错
答案: 【

18、 问题:Python只能在Windows系统上进行自动化测试。 ( )
选项:
A:对
B:错
答案: 【

19、 问题:GeckoDriver用于驱动Safari浏览器进行自动化测试。 ( )
选项:
A:对
B:错
答案: 【

20、 问题:在自动化测试中,可以使用同一个WebDriver驱动不同类型的浏览器。 ( )
选项:
A:对
B:错
答案: 【

第二章 单元测试

1、 问题:下列选项中,语法格式正确的定位代码是 ( )
选项:
A:find_elements(“name”,”标签名”)
B:find_element(“id”,”id属性值”)
C:find_element(By.CLASS NAME, “class属性值”)
D:find_element(By.CSS, “CSS选择器”)
答案: 【
find_element(“id”,”id属性值”)

2、 问题:下列选项中,不是Webdriver提供的定位方法的是( )
选项:
A:id属性定位
B:class属性定位
C:CSS定位
D:type定位
答案: 【
type定位

3、 问题:如何定位HTML中的第一个<input>标签?( )
选项:
A:find_elements(“tag name”,”input”)
B:find_elements(“tag name”,”input”)[0]
C:find_first_input()
D:find_element(“tag name”, “input[0]”)
答案: 【
find_elements(“tag name”,”input”)[0]

4、 问题:给出下面HTML代码,选项中可用于定位足球单选框的代码是( )
<html>
<body>
你最爱的体育运动是?<br/>
<input type=”radio” class=”football”> 足球</input><br>
<input type=”radio” class=”basketball”> 篮球</input><br>
<input type=”radio” class=”volleyball”> 排球</input><br>
</body>
</html>
页面显示效果:

选项:
A:find_element_by_class_name (“football “)[0]
B:find_element_by_class_name (“football “)
C:find_element(By. NAME, ” football”)
D:find_element(By. NAME, ” football”)[0]
答案: 【
find_element_by_class_name (“football “)

5、 问题:给出下面HTML代码,能定位学号输入框的代码是( )
<html>
<body>
学号:
<input type=”text” id=”number” name=”schoolnumber”></input><br>
学期:
<input type=”text” id=”semester” ></input><br>
成绩:
<input type=”text” id=”score” ></input>
</body>
</html>
页面显示效果:

选项:
A:find_elements(“xpath”,”//input[@id=’number ‘]”)[1]
B:find_element(by=”xpath”,value=”//input[@id=’semester’]”)
C:find_elements(By. XPATH, “//input[@name=’schoolscore’]”)[1]
D:find_element(“xpath”,”//input[@type=’text’]”)
答案: 【
find_element(“xpath”,”//input[@type=’text’]”)

6、 问题:给出下面HTML代码,不能定位用户名输入框的代码是( )
<html>
<body>
用户名: <br>
<input type=”text” id=”kw” name=”username”></input><br>
密码: <br>
<input type=”text” class=”a b c” name=”password”></input><br>
验证码: <br>
<input type=”text” id=”verification” name=”infro”></input>
</body>
</html>
页面显示效果:

选项:
A:find_elements(“css selector”,”br + input”)[0]
B:find_element(“id”,”kw”)
C:find_element(By.XPATH, “//input[@name = ‘username’]”)
D:find_element(“xpath”,”//input[starts-with(@id,’w’)]”)
答案: 【
find_element(“xpath”,”//input[starts-with(@id,’w’)]”)

7、 问题:给出下面HTML代码,选项中可用于定位密码输入框的代码是( ) 。
<html>
<body>
<label>账号:</label>
<input name=”username”></input><br>
<label>密码:</label>
<input name=”password”></input><br>
<button name=”submit”>登录</button><br>
</body>
</html>
页面显示效果:

选项:
A:find_elements(by=”tag_name”, value=”input”)[0]
B:find_element(by=”tag_name”, value=”button”)[1]
C:find_elements (By.TAG NAME, “input”)[1]
D:find_elements_by_tag_name(“input”)[1]
答案: 【
find_elements_by_tag_name(“input”)[1]

8、 问题:给出下面HTML代码,选项中可用于定位排球复选框的是( )
<html>
<body>
你最爱的体育运动是?<br/>
<input type=”checkbox” class=”football”>足球</input><br>
<input type=”checkbox” class=”basketball”>篮球</input><br>
<input type=”checkbox” class=”volleyball”>排球</input><br>
</body>
</html>
页面显示效果:

选项:
A:find_elements(“class name”,”volleyball “)[1]
B:find_element(“css selector”,”.volleyball”)
C:find_element(By.CSS_SELECTOR,”volleyball”)
D:find_element(by=”css selector”,value=”#volleyball”)
答案: 【
find_element(“css selector”,”.volleyball”)

9、 问题:给出下面HTML代码,利用链接定位方法定位百度学术链接的代码是( )
<html>
<body>
<a href=”http://fanyi.baidu.com//”>百度翻译</a><br>
<a href=”http://map.baidu.com/”>百度地图</a><br>
<a href=”http://xueshu.baidu.com/”>百度学术</a><br>
</body>
</html>
页面显示效果:

选项:
A:find_element(By.LINK TEXT, “学术”)
B:find_elements(“partial link text”,”百度学术”)
C:find_element(by=”link text”, value=”百度学术”)
D:find_element(by=”link_text”, value=”学术”)
答案: 【
find_element(by=”link text”, value=”百度学术”)

10、 问题:给出下面HTML代码,不能定位班级输入框的代码是( )
<html>
<body>
姓名:<input type=”text” id=”name” ></input><br>
学号:<input type=”text” id=”number “></input><br>
班级:<input type=”text” id=”class”></input><br>
</body>
</html>
页面显示效果:

选项:
A:find_elements(“tag name”,”input”)[2]
B:find_elements(“xpath”,”//input”)[2]
C:find_elements(“css selector”, “#class”)[0]
D:find_element(By.XPATH, “//input”)
答案: 【
find_element(By.XPATH, “//input”)

11、 问题:当一个页面中有多个相同class属性的元素时,可以使用哪些方法来定位特定的元素? ( )
选项:
A:使用CSS选择器并结合其他属性
B:使用XPath并结合其他属性
C:使用find_elements(“class name”,”class属性值”) 并结合下标定位
D:直接使用find_element(“class name”,”class属性值”)
答案: 【
使用CSS选择器并结合其他属性
使用XPath并结合其他属性
使用find_elements(“class name”,”class属性值”) 并结合下标定位

12、 问题:以下哪些方法可以用来定位所有<button>元素?( )
选项:
A:find_elements(“tag name”, “button”)
B:find_elements(“css selector”, “button”)
C:find_elements(“xpath”, “//button”)
D:find_all_buttons()
答案: 【
find_elements(“tag name”, “button”)
find_elements(“css selector”, “button”)
find_elements(“xpath”, “//button”)

13、 问题:如何用CSS选择器定位所有<p>标签内的<a>标签?( )
选项:
A:find_elements(“css selector”, “p a”)
B:find_elements(“xpath”, “//p//a”)
C:find_elements(“tag name”, “p a”)
D:find_elements(“css selector”, “p>a”)
答案: 【
find_elements(“css selector”, “p a”)
find_elements(“css selector”, “p>a”)

14、 问题:假设有一个<span>标签,其ID为unique-id,如何定位它?( )
选项:
A:find_element(“id”, “unique-id”)
B:find_element(“tag name”, “span#unique-id”)
C:find_element(“xpath”, “//span[@id=’unique-id’]”)
D:find_element(“css selector”, “span#unique-id”)
答案: 【
find_element(“id”, “unique-id”)
find_element(“xpath”, “//span[@id=’unique-id’]”)
find_element(“css selector”, “span#unique-id”)

15、 问题:假设有一个链接<a href=”https://example.com/contact”>Contact Us</a>,以下哪些方法可以定位它?( )
选项:
A:find_element(“link text”, “Contact Us”)
B:find_element(“partial link text”, “Contact”)
C:find_element(“xpath”, “//a[@href=’https://example.com/contact’]”)
D:find_element(“css selector”, “a[href=’https://example.com/contact’]”)
答案: 【
find_element(“link text”, “Contact Us”)
find_element(“partial link text”, “Contact”)
find_element(“xpath”, “//a[@href=’https://example.com/contact’]”)
find_element(“css selector”, “a[href=’https://example.com/contact’]”)

16、 问题:在Xpath定位中,要选择所有包含特定文本内容的<div>元素,可以使用哪些XPath表达式?( )
选项:
A://div[contains(text(), “特定文本”)]
B://div[.=”特定文本”]
C://div[starts-with(text(), “特定”)](以特定开头)
D://div[ends-with(text(), “文本”)] (以文本结尾,注:XPath 2.0及以上)
答案: 【
//div[contains(text(), “特定文本”)]
//div[.=”特定文本”]
//div[starts-with(text(), “特定”)](以特定开头)
//div[ends-with(text(), “文本”)] (以文本结尾,注:XPath 2.0及以上)

17、 问题:给出下面HTML代码,能定位姓名输入框的代码是 ( )
<html>
<body>
姓名:<input type=”text” id=”name” ></input><br>
生日:<input type=”text” id=”birthday” ></input><br>
身高:<input type=”text” id=”height” ></input><br>
</body>
</html>
页面显示效果:

选项:
A:find_element(“xpath”,”//input”)
B:find_elements(“xpath”,”//input”)[0]
C:find_elements(“xpath”, “//input”)[1]
D:find_elements(By.XPATH, “//input”)[1]
答案: 【
find_element(“xpath”,”//input”)
find_elements(“xpath”,”//input”)[0]

18、 问题:在Xpath定位中,使用XPath表达式//*[id=”header”]可以选择文档中所有ID为header的元素。 ( )
选项:
A:对
B:错
答案: 【

19、 问题:在CSS定位中,使用“ # ” 可以选中具有特定类名的元素。( )
选项:
A:对
B:错
答案: 【

20、 问题:在CSS定位中,选择器ul > li会选中所有<ul>元素内部的直接子元素<li>。( )
选项:
A:对
B:错
答案: 【

21、 问题:CSS定位中,选择器div p会选中所有<div>元素内部的<p>元素,无论层级深浅。( )
选项:
A:对
B:错
答案: 【

22、 问题://div[@class=’menu’] 是一个有效的 XPath 表达式,用于选择具有 class 属性值为 menu 的所有 <div> 元素。( )
选项:
A:对
B:错
答案: 【

23、 问题:CSS 选择器只能通过元素的 class 和 id 来定位元素。( )
选项:
A:对
B:错
答案: 【

第三章 单元测试

1、 问题:在Selenium WebDriver中,可以获取元素的属性的是( )
选项:
A:get_attribute()
B:is_displayed()
C:is_enabled()
D:is_selected()
答案: 【
get_attribute()

本门课程剩余章节答案为付费内容
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如需购买期末请联系客服QQ 2356025045
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦
请输入手机号或商家订单号
打不开请联系客服QQ 2356025045 商家订单号在哪里?点此了解

商家订单号查看步骤

打开支付宝
方法一:我的 > 账单 > 账单详情 > 更多>复制商家订单号
方法二:我的 > 账单 >搜索关键字白泽问答
> 账单详情 > 更多>复制商家订单号
方法三:联系客服QQ 2356025045
微信支付
我 > 支付 > 钱包 > 账单 > 账单详情

继续阅读