CN105760290A - Problem positioning method based on web front-end testing as well as related device and system - Google Patents
Problem positioning method based on web front-end testing as well as related device and system Download PDFInfo
- Publication number
- CN105760290A CN105760290A CN201410788334.XA CN201410788334A CN105760290A CN 105760290 A CN105760290 A CN 105760290A CN 201410788334 A CN201410788334 A CN 201410788334A CN 105760290 A CN105760290 A CN 105760290A
- Authority
- CN
- China
- Prior art keywords
- code
- source code
- information
- target web
- auxiliary
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 57
- 238000000034 method Methods 0.000 title claims abstract description 26
- 230000002159 abnormal effect Effects 0.000 claims abstract description 96
- 238000011161 development Methods 0.000 claims abstract description 21
- 230000005856 abnormality Effects 0.000 claims 13
- 239000003550 marker Substances 0.000 claims 9
- 238000002372 labelling Methods 0.000 claims 8
- 230000000007 visual effect Effects 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 8
- 238000004458 analytical method Methods 0.000 description 6
- 238000003780 insertion Methods 0.000 description 5
- 230000037431 insertion Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
本申请公开了一种基于网页前端测试的问题定位方法及相关装置、系统,其基于与目标网页的开发语言对应的选择器确定网页前端测试得到的问题信息在目标网页的源码中的位置,得到问题定位信息,并生成用于描述所述问题信息的辅助代码,再根据所述问题定位信息将所述辅助代码添加至源码中,然后根据该具有辅助代码的源码执行网页展示,使得在显示源码对应的目标网页的同时,辅助代码对应的问题信息也显示于目标网页中,从而在执行网页展示时,问题信息可以显示于对应的异常网页元素的相关位置,实现自动化、可视化的问题定位,提高定位效率、减少定位耗时,有利于快速确定各个问题的优先级,优先修复影响严重的问题,降低甚至消除目标页面崩溃的风险。
This application discloses a method for locating problems based on webpage front-end testing and related devices and systems. Based on a selector corresponding to the development language of the target webpage, it determines the position of the problem information obtained from the webpage front-end testing in the source code of the target webpage, and obtains Problem location information, and generate auxiliary codes for describing the problem information, then add the auxiliary codes to the source code according to the problem location information, and then perform webpage display according to the source code with the auxiliary codes, so that when the source code is displayed At the same time as the corresponding target web page, the problem information corresponding to the auxiliary code is also displayed on the target web page, so that when the web page is displayed, the problem information can be displayed at the relevant position of the corresponding abnormal web page element, realizing automatic and visual problem positioning and improving Locating efficiency and reducing time-consuming locating are conducive to quickly determining the priority of each problem, giving priority to repairing serious problems, and reducing or even eliminating the risk of target page crashes.
Description
技术领域technical field
本申请涉及网页前端测试技术领域,尤其涉及一种基于网页前端测试的问题定位方法及相关装置、系统。The present application relates to the technical field of webpage front-end testing, in particular to a method for locating problems based on webpage front-end testing and related devices and systems.
背景技术Background technique
网页(web)前端测试是指,对于通过HTML(即HyperTextMarkupLanguage,超文本标记语言)、CSS(CascadingStyleSheets,级联样式表)、XML(即ExtensibleMarkupLanguage,可扩展标记语言)及JavaScript等前端开发语言开发的网页,根据其源代码执行静态分析及动态分析,来获取网页的问题信息,以便根据该问题信息实现问题定位及修复,达到优化网页展示效果、提高网页加载速度的目的。Web page (web) front-end testing refers to the development of front-end development languages such as HTML (HyperTextMarkupLanguage, Hypertext Markup Language), CSS (CascadingStyleSheets, Cascading Style Sheets), XML (ExtensibleMarkupLanguage, Extensible Markup Language) and JavaScript. Web pages perform static analysis and dynamic analysis based on their source code to obtain problem information on the web page, so as to locate and repair problems based on the problem information, achieve the purpose of optimizing the display effect of the web page and improving the loading speed of the web page.
所谓问题定位,即确定问题信息对应的异常网页元素在网页中的位置。常用的问题定位方法需要人工辅助分析,即,相关技术人员首先通过分析问题信息中的ID、class(类)、url(即UniformResourceLocator,统一资源定位符)等特征来确定网页源码中存在相应特征的异常代码的位置,再通过比对源码和网页展示规则来确定异常代码对应的网页元素在网页中的位置,也即异常网页元素在网页中的位置。The so-called problem location refers to determining the position of the abnormal web page element corresponding to the problem information in the web page. Commonly used problem location methods require manual analysis, that is, relevant technical personnel first determine that there are corresponding features in the source code of the webpage by analyzing the ID, class (class), url (ie UniformResourceLocator, Uniform Resource Locator) and other features in the problem information. The position of the abnormal code, and then determine the position of the web page element corresponding to the abnormal code by comparing the source code and the web page display rules, that is, the position of the abnormal web page element in the web page.
上述基于人工辅助分析实现问题定位,不仅效率低、成本高,还导致无法快速确定网页中各个问题的影响面和修复优先级,不利于及时修复严重问题,存在较大的网页崩溃等风险。The above-mentioned problem location based on manual assisted analysis is not only low in efficiency and high in cost, but also makes it impossible to quickly determine the impact area and repair priority of each problem in the web page, which is not conducive to timely repair of serious problems, and there is a large risk of web page crashes.
发明内容Contents of the invention
为克服相关技术中存在的问题,本申请提供一种基于网页前端测试的问题定位方法及相关装置、系统。In order to overcome the problems existing in related technologies, the present application provides a method for locating problems based on webpage front-end testing, and related devices and systems.
本申请第一方面提供一种基于网页前端测试的问题定位方法;该方法包括:The first aspect of the present application provides a method for locating problems based on webpage front-end testing; the method includes:
获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息;Obtain the source code of the target web page and the problem information of the target web page obtained through the front-end test of the web page;
基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;Determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information;
生成用于描述所述问题信息的辅助代码;generate ancillary codes describing the problem information;
根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处;Adding the auxiliary code to a relevant position of the corresponding abnormal code in the source code according to the problem location information;
根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素的相关位置处。Executing webpage display according to the source code with auxiliary code, so that the problem information is displayed at the relevant position of the corresponding abnormal webpage element in the target webpage.
结合第一方面,在第一方面的第一种可行的实施方式中,所述根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,包括:With reference to the first aspect, in the first feasible implementation manner of the first aspect, adding the auxiliary code to the relevant position of the corresponding exception code in the source code according to the problem location information includes:
根据所述源码解析得到目标网页对应的文件对象模型DOM;According to the source code parsing, the document object model DOM corresponding to the target web page is obtained;
根据所述问题定位信息确定所述DOM中的问题节点;determining a problem node in the DOM according to the problem location information;
确定所述问题节点在目标网页中对应的异常元素展示区域;Determining the abnormal element display area corresponding to the problem node in the target webpage;
根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。An area related to the abnormal element display area is selected as a problem information display area according to preset rules, and the auxiliary code is added to a code position corresponding to the problem information display area in the source code.
结合第一方面第一种可行的实施方式,在第一方面的第二种可行的实施方式中,所述问题定位方法还包括:With reference to the first feasible implementation manner of the first aspect, in the second feasible implementation manner of the first aspect, the problem location method further includes:
生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。Generate a tag code corresponding to the default tag, and add the tag code to the source code, so that the default tag is displayed in the abnormal element display area when displaying the target webpage.
本申请第二方面提供一种基于网页前端测试的问题定位装置;该装置包括:The second aspect of the present application provides a device for locating problems based on webpage front-end testing; the device includes:
测试结果获取单元,用于获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息;The test result acquisition unit is used to obtain the source code of the target webpage and the problem information of the target webpage obtained through the front-end test of the webpage;
定位信息获取单元,用于基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;A positioning information acquisition unit, configured to determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem positioning information;
辅助代码生成单元,用于生成用于描述所述问题信息的辅助代码;an auxiliary code generating unit, configured to generate auxiliary codes for describing the problem information;
源码编辑单元,用于根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处;A source code editing unit, configured to add the auxiliary code to a relevant position of the corresponding abnormal code in the source code according to the problem location information;
网页展示单元,用于根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素的相关位置处。The web page display unit is configured to perform web page display according to the source code with auxiliary codes, so that the problem information is displayed at the relevant position of the corresponding abnormal web page element in the target web page.
结合第二方面,在第二方面的第一种可行的实施方式中,所述源码编辑单元包括:With reference to the second aspect, in the first possible implementation manner of the second aspect, the source code editing unit includes:
DOM生成模块,用于根据所述源码解析得到目标网页对应的文件对象模型DOM;DOM generation module, for obtaining the document object model DOM corresponding to the target web page according to the source code parsing;
问题节点确定模块,用于根据所述问题定位信息确定所述DOM中的问题节点;A problem node determining module, configured to determine a problem node in the DOM according to the problem location information;
异常区域确定模块,用于确定所述问题节点在目标网页中对应的异常元素展示区域;An abnormal area determination module, configured to determine the abnormal element display area corresponding to the problem node in the target web page;
辅助代码插入模块,用于根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。An auxiliary code insertion module, configured to select an area related to the abnormal element display area as a problem information display area according to preset rules, and add the auxiliary code to the code position corresponding to the problem information display area in the source code place.
结合第二方面的第一种可行的实施方式,在第二方面的第二种可行的实施方式中,所述源码编辑单元还包括:With reference to the first feasible implementation manner of the second aspect, in the second feasible implementation manner of the second aspect, the source code editing unit further includes:
标记代码插入模块,用于生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。a markup code insertion module, configured to generate a markup code corresponding to a preset markup, and add the markup code to the source code, so that the preset markup is displayed in the abnormal element display area when displaying the target webpage .
本申请第三方面提供一种服务器,用于基于网页前端测试的问题定位;该服务器包括:The third aspect of the present application provides a server for problem location based on web front-end testing; the server includes:
处理器;processor;
用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
其中,所述处理器被配置为:Wherein, the processor is configured as:
获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息;Obtain the source code of the target web page and the problem information of the target web page obtained through the front-end test of the web page;
基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;Determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information;
生成用于描述所述问题信息的辅助代码;generate ancillary codes describing the problem information;
根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,并将所述具有辅助代码的源码发送至客户端,使得所述客户端根据所述具有辅助代码的源码执行网页展示。According to the problem location information, add the auxiliary code to the relevant position of the corresponding abnormal code in the source code, and send the source code with the auxiliary code to the client, so that the client can The source code of the code executes the web page display.
结合第三方面,在第三方面第一种可行的实施方式中,为实现根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,所述服务器被配置为:With reference to the third aspect, in the first feasible implementation manner of the third aspect, in order to add the auxiliary code to the relevant position of the corresponding exception code in the source code according to the problem location information, the server is Configured as:
根据所述源码解析得到目标网页对应的文件对象模型DOM;According to the source code parsing, the document object model DOM corresponding to the target web page is obtained;
根据所述问题定位信息确定所述DOM中的问题节点;determining a problem node in the DOM according to the problem location information;
确定所述问题节点在目标网页中对应的异常元素展示区域;Determining the abnormal element display area corresponding to the problem node in the target webpage;
根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。An area related to the abnormal element display area is selected as a problem information display area according to preset rules, and the auxiliary code is added to a code position corresponding to the problem information display area in the source code.
结合第三方面第一种可行的实施方式,在第三方面第二种可行的实施方式中,所述服务器还被配置为:With reference to the first feasible implementation manner of the third aspect, in the second feasible implementation manner of the third aspect, the server is further configured to:
生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。Generate a tag code corresponding to the default tag, and add the tag code to the source code, so that the default tag is displayed in the abnormal element display area when displaying the target webpage.
本申请第四方面提供一种网页前端测试及问题定位系统,包括:前端测试子系统、定位服务器和客户端;The fourth aspect of the present application provides a webpage front-end test and problem location system, including: a front-end test subsystem, a location server and a client;
所述前端测试子系统被配置为:The front-end testing subsystem is configured as:
根据目标网页的源码对目标网页执行前端测试,得到目标网页的问题信息;Perform a front-end test on the target webpage according to the source code of the target webpage, and obtain the problem information of the target webpage;
所述定位服务器被配置为:The location server is configured to:
获取所述源码和问题信息;Obtain the source code and problem information;
基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;Determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information;
生成用于描述所述问题信息的辅助代码;generate ancillary codes describing the problem information;
根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,并将所述具有辅助代码的源码发送至客户端;Add the auxiliary code to the relevant position of the corresponding abnormal code in the source code according to the problem location information, and send the source code with the auxiliary code to the client;
所述客户端被配置为:The client is configured as:
根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素的相关位置处。Executing webpage display according to the source code with auxiliary code, so that the problem information is displayed at the relevant position of the corresponding abnormal webpage element in the target webpage.
结合第四方面,在第四方面第一种可行的实施方式中,为实现根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,所述定位服务器被配置为:With reference to the fourth aspect, in the first feasible implementation manner of the fourth aspect, in order to add the auxiliary code to the relevant position of the corresponding exception code in the source code according to the problem location information, the location server is configured as:
根据所述源码解析得到目标网页对应的文件对象模型DOM;According to the source code parsing, the document object model DOM corresponding to the target web page is obtained;
根据所述问题定位信息确定所述DOM中的问题节点;determining a problem node in the DOM according to the problem location information;
确定所述问题节点在所述源码中对应的异常代码区域;determining the abnormal code area corresponding to the problem node in the source code;
将所述辅助代码添加至所述源码中对应的异常代码区域的相关位置处。The auxiliary code is added to the relevant position of the corresponding exception code area in the source code.
结合第四方面第一种可行的实施方式,在第四方面第二种可行的实施方式中,所述服务器还被配置为:With reference to the first feasible implementation manner of the fourth aspect, in the second feasible implementation manner of the fourth aspect, the server is further configured to:
生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。Generate a tag code corresponding to the default tag, and add the tag code to the source code, so that the default tag is displayed in the abnormal element display area when displaying the target webpage.
由以上技术方案可知,本申请实施例对于网页前端测试得到的问题信息,首先基于与目标网页的开发语言对应的选择器确定所述问题信息在目标网页的源码中的位置,得到问题定位信息,并生成用于描述所述问题信息的辅助代码,再根据所述问题定位信息将所述辅助代码添加至所述源码中,然后根据该具有辅助代码的源码执行网页展示,使得在显示源码对应的目标网页的同时,辅助代码对应的问题信息也显示于目标网页中,且由于辅助代码添加至源码中的位置不是任意的,而是根据所述问题定位信息确定的对应的异常代码的相关位置,从而在执行网页展示时,问题信息可以显示于对应的异常网页元素的相关位置;根据上述网页展示结果,可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。It can be seen from the above technical solutions that, for the problem information obtained by the front-end test of the webpage in the embodiment of the present application, first, based on the selector corresponding to the development language of the target webpage, the position of the problem information in the source code of the target webpage is determined to obtain the problem location information, and generate auxiliary codes for describing the problem information, then add the auxiliary codes to the source code according to the problem location information, and then perform webpage display according to the source codes with the auxiliary codes, so that the displayed source code corresponds to At the same time as the target web page, the problem information corresponding to the auxiliary code is also displayed on the target web page, and because the position where the auxiliary code is added to the source code is not arbitrary, but the relative position of the corresponding abnormal code determined according to the problem location information, Therefore, when performing web page display, the problem information can be displayed at the relevant position of the corresponding abnormal web page element; according to the above web page display results, the problem information of each sub-problem existing in the target web page and the corresponding problem generation position can be intuitively displayed to the Relevant technicians have realized automatic and visual problem positioning, which improves the positioning efficiency and reduces time-consuming, which is conducive to quickly determining the priority of each problem and prioritizing the repair of serious problems, thereby reducing or even eliminating the risk of target page crashes.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.
图1是本申请实施例提供的一种基于网页前端测试的问题定位方法的流程图。FIG. 1 is a flow chart of a method for locating problems based on web front-end testing provided by an embodiment of the present application.
图2是本申请实施例提供的另一种基于网页前端测试的问题定位方法的流程图。FIG. 2 is a flow chart of another method for locating problems based on web front-end testing provided by an embodiment of the present application.
图3是图2所示的问题定位方法中数据处理示意图。FIG. 3 is a schematic diagram of data processing in the problem location method shown in FIG. 2 .
图4是本申请实施例提供的问题定位方法中确定问题信息展示区域的示意图。Fig. 4 is a schematic diagram of determining a problem information display area in the problem location method provided by the embodiment of the present application.
图5是本申请实施例提供的一种基于网页前端测试的问题定位装置的框图。FIG. 5 is a block diagram of an apparatus for locating problems based on webpage front-end testing provided by an embodiment of the present application.
图6是本申请实施例提供的另一种基于网页前端测试的问题定位装置的框图。FIG. 6 is a block diagram of another device for locating problems based on webpage front-end testing provided by an embodiment of the present application.
图7是本申请实施例提供的一种服务器的框图。Fig. 7 is a block diagram of a server provided by an embodiment of the present application.
图8是本申请实施例提供的一种网页前端测试及问题定位系统的框图。FIG. 8 is a block diagram of a webpage front-end testing and problem location system provided by an embodiment of the present application.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with aspects of the invention as recited in the appended claims.
图1为本申请实施例提供的一种基于网页前端测试的问题定位方法的流程图。如图1所示,该方法包括以下步骤。FIG. 1 is a flow chart of a method for locating problems based on web front-end testing provided by an embodiment of the present application. As shown in Figure 1, the method includes the following steps.
S11、获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息。S11. Obtain the source code of the target webpage, and the problem information of the target webpage obtained through the front-end test of the webpage.
网页前端测试系统完成对目标网页的前端测试,得到的测试结果,即为所述问题信息;该问题信息可以包括一个或多个子问题信息,每个子问题信息对应目标网页中的一个具体问题,例如页面标题未居中显示、某个小标题的链接错误等;每个子问题信息可以包括相应的问题类型、产生原因及修复建议等信息。The webpage front-end testing system completes the front-end test of the target webpage, and the test result obtained is the problem information; the problem information can include one or more sub-question information, and each sub-question information corresponds to a specific problem in the target webpage, for example The page title is not displayed in the center, the link of a subtitle is wrong, etc.; each sub-problem information can include the corresponding problem type, cause, and repair suggestions.
S12、基于与目标网页的开发语言对应的选择器确定所述问题信息在所述源码中的位置,得到问题定位信息。S12. Determine the position of the problem information in the source code based on the selector corresponding to the development language of the target web page, and obtain problem location information.
上述选择器通常用于对网页中具有指定特征的元素或组件定义特定的样式,例如将id属性为指定值的元素颜色定义为红色。本申请实施例利用选择器,将上述问题信息涉及的相关特征对应的异常网页元素设置为特定的样式,从而确定这些异常网页元素对应的异常代码在源码中的位置,即确定上述问题定位信息。The above-mentioned selector is usually used to define a specific style for an element or component with a specified feature in a web page, for example, to define the color of an element whose id attribute is a specified value as red. The embodiment of the present application uses a selector to set the abnormal web page elements corresponding to the relevant features involved in the above problem information into a specific style, so as to determine the position of the abnormal code corresponding to these abnormal web page elements in the source code, that is, to determine the above problem location information.
基于不同的前端开发语言,选择器的类型也不同;对于基于HTML的目标网页,可以采用CSS选择器或XPATH(即XMLPathLanguage,XML路径语言)选择器。例如,基于CSS选择器,选择HTML源码中id属性值为“ID”的元素可以采用如下代码:$(“.ID”);又如,基于XPATH选择器,选择HTML源码中body元素中所有名称为div的子元素可以采用如下代码:/html/body/div。Different front-end development languages have different types of selectors; for HTML-based target web pages, CSS selectors or XPATH (ie XMLPathLanguage, XML Path Language) selectors can be used. For example, based on the CSS selector, the following code can be used to select the element whose id attribute value is "ID" in the HTML source code: $(".ID"); another example, based on the XPATH selector, select all the names in the body element in the HTML source code The following code can be used as a child element of div: /html/body/div.
S13、生成用于描述所述问题信息的辅助代码。S13. Generate auxiliary codes for describing the question information.
S14、根据所述问题定位信息将所述辅助代码添加至所述源码中。S14. Add the auxiliary code to the source code according to the problem location information.
由于上述问题定位信息分别记录了各个子问题信息对应的异常代码在源码中的位置,根据该问题定位信息可以将各个子问题信息的辅助代码添加至对应的异常代码的相关位置;例如,可以统一设定将辅助代码添加至对应的异常代码的首行之前。Since the above problem location information respectively records the position of the exception code corresponding to each sub-problem information in the source code, according to the problem location information, the auxiliary code of each sub-problem information can be added to the relevant position of the corresponding exception code; for example, it is possible to unify Set to add the auxiliary code before the first line of the corresponding exception code.
S15、根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素所在位置。S15. Perform webpage display according to the source code with the auxiliary code, so that the problem information is displayed at the location of the corresponding abnormal webpage element in the target webpage.
根据辅助代码在源码中的添加位置,其对应的问题信息也相应显示与目标网页中异常代码对应的异常网页元素的相关位置处;例如,上文将辅助代码添加至对应的异常代码的首行之前,则执行网页展示时,辅助代码对应的问题信息也相应显示于异常代码对应的异常网页元素之前。According to where the auxiliary code is added in the source code, the corresponding problem information is also displayed at the relevant position of the abnormal web page element corresponding to the abnormal code in the target web page; for example, the auxiliary code is added to the first line of the corresponding abnormal code above Previously, when the web page was displayed, the problem information corresponding to the auxiliary code was also displayed before the abnormal web page element corresponding to the abnormal code.
由以上技术方案可知,本申请实施例对于网页前端测试得到的问题信息,首先基于与目标网页的开发语言对应的选择器确定所述问题信息在目标网页的源码中的位置,得到问题定位信息,并生成用于描述所述问题信息的辅助代码,再根据所述问题定位信息将所述辅助代码添加至所述源码中,然后根据该具有辅助代码的源码执行网页展示,使得在显示源码对应的目标网页的同时,辅助代码对应的问题信息也显示于目标网页中,且由于辅助代码添加至源码中的位置不是任意的,而是根据所述问题定位信息确定的对应的异常代码的相关位置,从而在执行网页展示时,问题信息可以显示于对应的异常网页元素的相关位置;根据上述网页展示结果,可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。It can be seen from the above technical solutions that, for the problem information obtained by the front-end test of the webpage in the embodiment of the present application, first, based on the selector corresponding to the development language of the target webpage, the position of the problem information in the source code of the target webpage is determined to obtain the problem location information, and generate auxiliary codes for describing the problem information, then add the auxiliary codes to the source code according to the problem location information, and then perform webpage display according to the source codes with the auxiliary codes, so that the displayed source code corresponds to At the same time as the target web page, the problem information corresponding to the auxiliary code is also displayed on the target web page, and because the position where the auxiliary code is added to the source code is not arbitrary, but the relative position of the corresponding abnormal code determined according to the problem location information, Therefore, when performing web page display, the problem information can be displayed at the relevant position of the corresponding abnormal web page element; according to the above web page display results, the problem information of each sub-problem existing in the target web page and the corresponding problem generation position can be intuitively displayed to the Relevant technicians have realized automatic and visual problem positioning, which improves the positioning efficiency and reduces time-consuming, which is conducive to quickly determining the priority of each problem and prioritizing the repair of serious problems, thereby reducing or even eliminating the risk of target page crashes.
图2为本申请实施例提供的另一种基于网页前端测试的问题定位方法的流程图,图3为图2所示的问题定位方法中数据处理示意图。参照图2和图3,该问题定位方法包括以下步骤。FIG. 2 is a flow chart of another method for locating problems based on webpage front-end testing provided by an embodiment of the present application, and FIG. 3 is a schematic diagram of data processing in the method for locating problems shown in FIG. 2 . Referring to Fig. 2 and Fig. 3, the problem location method includes the following steps.
S21、获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息。S21. Obtain the source code of the target webpage, and the problem information of the target webpage obtained through the front-end test of the webpage.
S22、基于与目标网页的开发语言对应的选择器确定所述问题信息在所述源码中的位置,得到问题定位信息。S22. Determine the position of the problem information in the source code based on the selector corresponding to the development language of the target web page, and obtain problem location information.
S23、生成用于描述所述问题信息的辅助代码。S23. Generate auxiliary codes for describing the question information.
S24、根据所述源码解析得到目标网页对应的文件对象模型。S24. Obtain a file object model corresponding to the target web page according to the source code analysis.
上述文件对象模型(DocumentObjectModel,DOM)又称DOM树,是具有层次结构关系的多个节点的集合。目标网页中的每个网页元素视为一个节点,将各个节点根据对应的网页元素之间的关系连接起来,就可以得到一个树形结构的模型,即DOM树。The above-mentioned Document Object Model (DocumentObjectModel, DOM) is also called a DOM tree, which is a collection of multiple nodes with hierarchical relationship. Each webpage element in the target webpage is regarded as a node, and a tree-structured model, that is, a DOM tree, can be obtained by connecting each node according to the relationship between corresponding webpage elements.
S25、根据所述问题定位信息确定所述DOM中的问题节点。S25. Determine a problem node in the DOM according to the problem location information.
S26、确定所述问题节点在目标网页中对应的异常元素展示区域。S26. Determine the abnormal element display area corresponding to the problem node in the target web page.
S27、根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。S27. Select an area related to the abnormal element display area as a problem information display area according to preset rules, and add the auxiliary code to a code position corresponding to the problem information display area in the source code.
由于本实施例要实现在目标网页中显示问题信息,故可以根据问题信息在目标网页中的展示区域确定辅助代码在源码中的添加位置;其中,问题信息在目标网页中的展示区域可以根据对应的异常网页元素在目标网页中的展示区域设定。本申请实施例预先设定问题信息展示区域和异常元素展示区域之间的相对位置,即上述预设规则,从而可以在通过DOM树确定目标网页中各个子问题对应的异常元素展示区域后,根据上述预设规则确定对应的问题信息展示区域,进而将辅助代码添加至所述问题信息展示区域对应的代码位置处。根据目标网页排版等实际应用需求,上述预设规则可以为:问题信息展示区域410位于异常元素展示区域420的左上方或右上方,如图4所示;当然,上述预设规则还可以为:问题信息展示区域位于异常元素展示区域的、左下方、正上方等位置处。Since this embodiment will realize the display of question information in the target webpage, it is possible to determine the adding position of the auxiliary code in the source code according to the display area of the question information in the target webpage; wherein, the display area of the question information in the target webpage can be based on the corresponding The display zone setting of the unusual page element in the landing page. The embodiment of the present application pre-sets the relative position between the problem information display area and the abnormal element display area, that is, the above-mentioned preset rules, so that after determining the abnormal element display area corresponding to each sub-question in the target webpage through the DOM tree, according to The above preset rules determine the corresponding question information display area, and then add the auxiliary code to the code position corresponding to the question information display area. According to actual application requirements such as the typesetting of the target webpage, the above preset rule can be: the problem information display area 410 is located at the upper left or upper right of the abnormal element display area 420, as shown in FIG. 4; of course, the above preset rule can also be: The problem information display area is located at the bottom left, right above, etc. of the abnormal element display area.
S28、根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素所在位置。S28. Perform webpage display according to the source code with the auxiliary code, so that the problem information is displayed at the location of the corresponding abnormal webpage element in the target webpage.
上述步骤S24至S27实现了将辅助代码添加至目标网页的源码中,基于此,本申请实施例可以在根据上述具有辅助代码的源码执行网页展示时,将目标网页中各个子问题的问题信息分别显示于对应的异常元素展示区域的相关区域内(也即对应的问题信息展示区域内),使得相关技术人员可以从该目标网页显示界面中直观的得知各个异常元素的位置及具体的问题信息。The above steps S24 to S27 realize the addition of auxiliary codes to the source code of the target webpage. Based on this, the embodiment of the present application can display the question information of each sub-question in the target webpage when executing the webpage display according to the above-mentioned source code with auxiliary codes. Displayed in the relevant area of the corresponding abnormal element display area (that is, in the corresponding problem information display area), so that relevant technical personnel can intuitively know the location of each abnormal element and specific problem information from the display interface of the target web page .
由以上技术方案可知,本申请实施例首先通过目标网页的前端开发语言相匹配的选择器,根据目标网页的问题信息在目标网页的源码中进行筛选,得到相应的问题定位信息;再根据该问题定位信息,确定目标网页的Dom树中的问题节点,进而确定问题节点在源码中对应的异常代码所在的位置;将问题信息对应的辅助代码添加至源码中相应的异常代码所在区域的相关位置处;最终根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素所在显示区域的相关位置处,从而可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。As can be seen from the above technical solutions, the embodiments of the present application first use the selector that matches the language of the front-end development of the target webpage to screen the source code of the target webpage according to the problem information of the target webpage to obtain the corresponding problem location information; then according to the problem Locate the information, determine the problem node in the Dom tree of the target web page, and then determine the location of the abnormal code corresponding to the problem node in the source code; add the auxiliary code corresponding to the problem information to the relevant position of the area where the corresponding abnormal code is located in the source code ;Finally, perform webpage display according to the source code with auxiliary code, so that the problem information is displayed at the relevant position of the display area where the corresponding abnormal webpage element is located in the target webpage, so that each sub-problem existing in the target webpage can be intuitively displayed The problem information and the corresponding problem location are displayed to relevant technical personnel, which realizes automatic and visual problem positioning, improves positioning efficiency and reduces time-consuming, which is conducive to quickly determining the priority of each problem and prioritizing the repair of serious problems. Reduce or even eliminate the risk of landing page crashes.
在本申请的其他实施例中,为提高问题定位效果,使得目标网页中的异常元素更突出易辨,在执行步骤S26,即确定异常元素展示区域后,还可以执行如下步骤:生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中。In other embodiments of the present application, in order to improve the effect of problem location and make the abnormal elements in the target web page more prominent and easy to distinguish, after performing step S26, that is, after determining the display area of abnormal elements, the following steps can also be performed: generating preset tags corresponding markup code, and adding the markup code into the source code.
参照图4,上述预设标记可以为:包围上述异常元素展示区域的标记边框431、覆盖上述异常元素展示区域的标记图层432;另外,还可以设置标记边框431和标记图层432的颜色(为达到标记效果,优选不同于目标网页的背景色及异常元素的底色(或主颜色的颜色作为预设标记的颜色)。Referring to Fig. 4, the above-mentioned preset mark can be: a mark frame 431 surrounding the above-mentioned abnormal element display area, a mark layer 432 covering the above-mentioned abnormal element display area; in addition, the color of the mark frame 431 and the mark layer 432 can also be set ( In order to achieve the marking effect, it is preferred to be different from the background color of the target webpage and the background color of the abnormal element (or the color of the main color as the color of the default mark).
图5为本申请实施例提供的一种基于网页前端测试的问题定位装置的结构框图。参照图5,该问题定位装置包括:测试结果获取单元110、定位信息获取单元120、辅助代码生成单元130、源码编辑单元140和网页展示单元150。FIG. 5 is a structural block diagram of a device for locating problems based on webpage front-end testing provided by an embodiment of the present application. Referring to FIG. 5 , the problem location device includes: a test result acquisition unit 110 , a location information acquisition unit 120 , an auxiliary code generation unit 130 , a source code editing unit 140 and a webpage display unit 150 .
该测试结果获取单元110被配置为,获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息。The test result acquisition unit 110 is configured to acquire the source code of the target webpage and the problem information of the target webpage obtained through the front-end test of the webpage.
该定位信息获取单元120被配置为,基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息。The location information acquisition unit 120 is configured to determine the location of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information.
该辅助代码生成单元130被配置为,将所述定位信息上传至服务器,以便用户从所述服务器中获取所述定位信息。The auxiliary code generation unit 130 is configured to upload the location information to a server, so that the user can obtain the location information from the server.
该源码编辑单元140被配置为,根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处。The source code editing unit 140 is configured to add the auxiliary code to a relevant position of the corresponding abnormal code in the source code according to the problem location information.
该网页展示单元150被配置为,根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素的相关位置处。The web page display unit 150 is configured to perform web page display according to the source code with auxiliary codes, so that the problem information is displayed at the relevant position of the corresponding abnormal web page element in the target web page.
由以上技术方案可知,本申请实施例可以实现在显示源码对应的目标网页的同时,辅助代码对应的问题信息也显示于目标网页中,且由于辅助代码添加至源码中的位置不是任意的,而是根据所述问题定位信息确定的对应的异常代码的相关位置,从而在执行网页展示时,问题信息可以显示于对应的异常网页元素的相关位置;根据上述网页展示结果,可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。From the above technical solution, it can be seen that in the embodiment of the present application, while displaying the target web page corresponding to the source code, the problem information corresponding to the auxiliary code is also displayed on the target web page, and because the position where the auxiliary code is added to the source code is not arbitrary, and It is the relevant position of the corresponding abnormal code determined according to the problem location information, so that when the web page is displayed, the problem information can be displayed at the relevant position of the corresponding abnormal web page element; according to the above web page display result, the target web page can be visually The problem information of each sub-problem in the system and the corresponding problem location are displayed to relevant technical personnel, which realizes automatic and visual problem positioning, improves positioning efficiency and reduces time-consuming, which is conducive to quickly determining the priority of each problem and prioritizing repair Affect serious issues, thereby reducing or even eliminating the risk of the target page crashing.
参照图6,在本申请一个可行的实施例中,源码编辑单元140可以包括:Referring to FIG. 6, in a feasible embodiment of the present application, the source code editing unit 140 may include:
其中,该DOM生成模块141被配置为,根据所述源码解析得到目标网页对应的文件对象模型DOM;Wherein, the DOM generation module 141 is configured to obtain the DOM corresponding to the target web page according to the source code analysis;
该问题节点确定模块142被配置为,根据所述问题定位信息确定所述DOM中的问题节点;The problem node determining module 142 is configured to determine the problem node in the DOM according to the problem location information;
该异常区域确定模块143被配置为,确定所述问题节点在目标网页中对应的异常元素展示区域;The abnormal area determination module 143 is configured to determine the abnormal element display area corresponding to the problem node in the target web page;
该辅助代码插入模块144被配置为,根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。The auxiliary code insertion module 144 is configured to select an area related to the abnormal element display area as the problem information display area according to preset rules, and add the auxiliary code to the source code corresponding to the problem information display area. at the code location.
另外,上述源码编辑单元140还可以包括:标记代码插入模块145。该标记代码插入模块145被配置为,生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。In addition, the above-mentioned source code editing unit 140 may further include: a marking code insertion module 145 . The markup code insertion module 145 is configured to generate markup code corresponding to a preset markup, and add the markup code to the source code, so that the preset markup is displayed on the abnormal element when displaying the target webpage in the display area.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
另外,本申请实施例还提供了一种计算机存储介质,例如可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等;该计算机存储介质中存储有程序,当所述存储介质中的程序由相关设备(如服务器)的处理器执行时,使得该相关设备能够执行上述方法实施例中记载的问题定位方法的部分或全部步骤。In addition, the embodiment of the present application also provides a computer storage medium, such as ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.; the computer storage medium stores programs, When the program in the storage medium is executed by a processor of a related device (such as a server), the related device is enabled to execute some or all steps of the problem location method described in the above method embodiments.
图7是根据一示例性实施例示出的一种实现基于网页前端测试的问题定位的服务器600的框图。参照图7,服务器600包括处理组件622,其进一步包括一个或多个处理器,以及由存储器632所代表的存储器资源,用于存储可由处理组件622的执行的指令,例如应用程序。存储器632中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件622被配置为执行指令,以执行上述问题定位方法。Fig. 7 is a block diagram of a server 600 for implementing problem location based on web front-end testing according to an exemplary embodiment. 7, server 600 includes processing component 622, which further includes one or more processors, and a memory resource represented by memory 632 for storing instructions executable by processing component 622, such as application programs. The application program stored in memory 632 may include one or more modules each corresponding to a set of instructions. In addition, the processing component 622 is configured to execute instructions to perform the above-mentioned method for locating problems.
服务器600还可以包括一个电源组件626被配置为执行服务器600的电源管理,一个有线或无线网络接口650被配置为将服务器600连接到网络,和一个输入输出(I/O)接口658。服务器600可以操作基于存储在存储器632的操作系统,例如WindowsServerTM,MacOSXTM,UnixTM,LinuxTM,FreeBSDTM或类似。Server 600 may also include a power component 626 configured to perform power management of server 600 , a wired or wireless network interface 650 configured to connect server 600 to a network, and an input-output (I/O) interface 658 . The server 600 may operate based on an operating system stored in the memory 632, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
其中,本实施例中,处理组件622通过执行存储器632中的指令,可以完成如下步骤:Wherein, in this embodiment, the processing component 622 can complete the following steps by executing the instructions in the memory 632:
获取目标网页的源码,以及通过网页前端测试得到的目标网页的问题信息;Obtain the source code of the target web page and the problem information of the target web page obtained through the front-end test of the web page;
基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;Determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information;
生成用于描述所述问题信息的辅助代码;generate ancillary codes describing the problem information;
根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,并将所述具有辅助代码的源码发送至客户端,使得所述客户端根据所述具有辅助代码的源码执行网页展示。According to the problem location information, add the auxiliary code to the relevant position of the corresponding abnormal code in the source code, and send the source code with the auxiliary code to the client, so that the client can The source code of the code executes the web page display.
在本申请一个可行的实施例中,为实现根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,处理组件622可以执行如下步骤:In a feasible embodiment of the present application, in order to add the auxiliary code to the relevant position of the corresponding exception code in the source code according to the problem location information, the processing component 622 may perform the following steps:
根据所述源码解析得到目标网页对应的文件对象模型DOM;According to the source code parsing, the document object model DOM corresponding to the target web page is obtained;
根据所述问题定位信息确定所述DOM中的问题节点;determining a problem node in the DOM according to the problem location information;
确定所述问题节点在目标网页中对应的异常元素展示区域;Determining the abnormal element display area corresponding to the problem node in the target webpage;
根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。An area related to the abnormal element display area is selected as a problem information display area according to preset rules, and the auxiliary code is added to a code position corresponding to the problem information display area in the source code.
在本申请一个可行的实施例中,处理组件622可以执行如下步骤:In a feasible embodiment of the present application, the processing component 622 may perform the following steps:
生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。Generate a tag code corresponding to the default tag, and add the tag code to the source code, so that the default tag is displayed in the abnormal element display area when displaying the target webpage.
由以上技术方案可知,本申请实施例提供的服务器可以实现在显示源码对应的目标网页的同时,辅助代码对应的问题信息也显示于目标网页中,且由于辅助代码添加至源码中的位置不是任意的,而是根据所述问题定位信息确定的对应的异常代码的相关位置,从而在执行网页展示时,问题信息可以显示于对应的异常网页元素的相关位置;根据上述网页展示结果,可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。It can be seen from the above technical solutions that the server provided by the embodiment of the present application can display the target web page corresponding to the source code, and the problem information corresponding to the auxiliary code can also be displayed on the target web page, and because the position where the auxiliary code is added to the source code is not arbitrary Instead, the relevant location of the corresponding abnormal code is determined according to the problem location information, so that when the webpage is displayed, the problem information can be displayed at the relevant location of the corresponding abnormal webpage element; according to the above webpage display results, it can be intuitively Display the problem information of each sub-problem in the target webpage and the corresponding problem location to relevant technical personnel, realize automatic and visual problem positioning, improve positioning efficiency, reduce time-consuming, and help quickly determine the priority of each problem , prioritizing fixes for high-impact issues, reducing or even eliminating the risk of target page crashes.
图8是本申请实施例提供的一种网页前端测试及问题定位系统700的结构示意图。参照图8,该系统包括:前端测试子系统710、定位服务器720和客户端730。FIG. 8 is a schematic structural diagram of a webpage front-end testing and problem location system 700 provided by an embodiment of the present application. Referring to FIG. 8 , the system includes: a front-end testing subsystem 710 , a positioning server 720 and a client 730 .
其中,前端测试子系统710被配置为:根据目标网页的源码对目标网页执行前端测试,得到目标网页的问题信息。Wherein, the front-end testing subsystem 710 is configured to: perform a front-end test on the target webpage according to the source code of the target webpage, and obtain problem information of the target webpage.
定位服务器720被配置为:The positioning server 720 is configured to:
获取所述源码和问题信息;Obtain the source code and problem information;
基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置,得到问题定位信息;Determine the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target webpage, and obtain problem location information;
生成用于描述所述问题信息的辅助代码;generate ancillary codes describing the problem information;
根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,并将所述具有辅助代码的源码发送至客户端Add the auxiliary code to the relevant position of the corresponding abnormal code in the source code according to the problem location information, and send the source code with the auxiliary code to the client
客户端730被配置为:根据所述具有辅助代码的源码执行网页展示,使得所述问题信息显示于目标网页中对应的异常网页元素的相关位置处。The client 730 is configured to: perform webpage presentation according to the source code with auxiliary codes, so that the problem information is displayed at the relevant position of the corresponding abnormal webpage element in the target webpage.
另外,在本申请其他可行的实施例中,上述操作“基于与目标网页的开发语言对应的选择器确定所述问题信息对应的异常代码在所述源码中的位置”也可以由前端测试子系统710执行,并将得到问题定位信息及对应的源码和问题信息存储于数据库中;相应的,定位服务器720可以在接收到客户端730的定位请求后,直接从数据库中获取目标网页的源码、问题信息和问题定位信息,继而执行后续生成辅助代码、将辅助代码添加至源码中等操作。In addition, in other feasible embodiments of the present application, the above operation of "determining the position of the abnormal code corresponding to the problem information in the source code based on the selector corresponding to the development language of the target web page" can also be performed by the front-end testing subsystem Step 710 executes, and stores the problem location information and the corresponding source code and problem information in the database; correspondingly, after receiving the location request from the client 730, the location server 720 can directly obtain the source code and problem information of the target webpage from the database. Information and problem location information, and then perform subsequent operations such as generating auxiliary codes and adding auxiliary codes to the source code.
在本申请一个可行的实施例中,为实现根据所述问题定位信息将所述辅助代码添加至所述源码中对应的异常代码的相关位置处,定位服务器720被配置为:In a feasible embodiment of the present application, in order to add the auxiliary code to the relevant position of the corresponding exception code in the source code according to the problem location information, the location server 720 is configured to:
根据所述源码解析得到目标网页对应的文件对象模型DOM;According to the source code parsing, the document object model DOM corresponding to the target web page is obtained;
根据所述问题定位信息确定所述DOM中的问题节点;determining a problem node in the DOM according to the problem location information;
确定所述问题节点在目标网页中对应的异常元素展示区域;Determining the abnormal element display area corresponding to the problem node in the target webpage;
根据预设规则选择与所述异常元素展示区域相关的区域作为问题信息展示区域,并将所述辅助代码添加至所述源码中所述问题信息展示区域对应的代码位置处。An area related to the abnormal element display area is selected as a problem information display area according to preset rules, and the auxiliary code is added to a code position corresponding to the problem information display area in the source code.
在本申请另一个可行的实施例中,定位服务器720还被配置为:In another feasible embodiment of the present application, the positioning server 720 is further configured to:
生成预设标记对应的标记代码,并将所述标记代码添加至所述源码中,以便在展示目标网页时将所述预设标记展示于所述异常元素展示区域内。Generate a tag code corresponding to the default tag, and add the tag code to the source code, so that the default tag is displayed in the abnormal element display area when displaying the target webpage.
由以上技术方案可知,本申请实施例提供的网页前端测试及问题定位系统可以实现对目标网页的前端测试,并将测试得到的问题信息显示于目标网页中对应的异常网页元素的相关位置;根据上述网页展示结果,可以直观地将目标网页中存在的各个子问题的问题信息及对应的问题产生位置展示给相关技术人员,实现了自动化、可视化的问题定位,定位效率提高、耗时减少,有利于快速确定各个问题的优先级,优先修复影响严重的问题,从而降低甚至消除目标页面崩溃的风险。As can be seen from the above technical solutions, the webpage front-end test and problem location system provided by the embodiment of the present application can realize the front-end test to the target webpage, and display the problem information obtained by the test on the relevant position of the corresponding abnormal webpage element in the target webpage; The display results of the above webpage can intuitively display the problem information of each sub-problem in the target webpage and the corresponding problem location to relevant technical personnel, realizing automatic and visual problem positioning, improving positioning efficiency, reducing time-consuming, and effectively It is helpful to quickly determine the priority of each problem, and fix the problems with serious impact first, so as to reduce or even eliminate the risk of target page crash.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, these modifications, uses or adaptations follow the general principles of the present invention and include common knowledge or conventional technical means in the technical field not disclosed in this application . The specification and examples are to be considered exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It should be understood that the present invention is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410788334.XA CN105760290B (en) | 2014-12-17 | 2014-12-17 | The problem of being tested based on webpage front-end localization method and relevant apparatus, system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410788334.XA CN105760290B (en) | 2014-12-17 | 2014-12-17 | The problem of being tested based on webpage front-end localization method and relevant apparatus, system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105760290A true CN105760290A (en) | 2016-07-13 |
CN105760290B CN105760290B (en) | 2018-11-13 |
Family
ID=56340308
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410788334.XA Expired - Fee Related CN105760290B (en) | 2014-12-17 | 2014-12-17 | The problem of being tested based on webpage front-end localization method and relevant apparatus, system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105760290B (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107168881A (en) * | 2017-06-07 | 2017-09-15 | 成都四象联创科技有限公司 | Code positioning and processing method extremely |
CN107784011A (en) * | 2016-08-30 | 2018-03-09 | 广州市动景计算机科技有限公司 | Web access method, client, web page server and programmable device |
CN108038020A (en) * | 2018-01-02 | 2018-05-15 | 福建中金在线信息科技有限公司 | Webpage fault trace method, apparatus, electronic equipment and computer-readable storage medium |
CN108268332A (en) * | 2017-08-10 | 2018-07-10 | 广州神马移动信息科技有限公司 | Webpage abnormality monitoring method, equipment and system |
CN108959057A (en) * | 2017-05-18 | 2018-12-07 | 腾讯科技(深圳)有限公司 | Test method, test device, storage equipment and the network equipment |
CN110866212A (en) * | 2019-11-14 | 2020-03-06 | 北京无限光场科技有限公司 | Page abnormity positioning method and device, electronic equipment and computer readable medium |
CN110955595A (en) * | 2019-11-13 | 2020-04-03 | 中信百信银行股份有限公司 | Problem repairing method and device, electronic equipment and computer readable storage medium |
CN111176871A (en) * | 2019-08-01 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Target application processing method and device, storage medium and electronic device |
CN111581063A (en) * | 2020-06-09 | 2020-08-25 | 北京大米未来科技有限公司 | Data processing method, readable storage medium and electronic device |
CN111930616A (en) * | 2020-07-27 | 2020-11-13 | 北京大米未来科技有限公司 | Data processing method and device, electronic equipment and readable storage medium |
CN113691405A (en) * | 2021-08-25 | 2021-11-23 | 北京知道创宇信息技术股份有限公司 | Access abnormity diagnosis method and device, storage medium and electronic equipment |
CN114880612A (en) * | 2022-05-11 | 2022-08-09 | 网易有道信息技术(北京)有限公司 | Method for formula layout exception management and related product |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100562872C (en) * | 2006-11-07 | 2009-11-25 | 北京酷讯科技有限公司 | Automatic moulding plate information locating method at the structuring webpage |
CN103365864B (en) * | 2012-03-28 | 2016-06-08 | 上海商派网络科技有限公司 | A kind of method of webpage front-end positioning data |
CN103377127B (en) * | 2012-04-28 | 2016-04-13 | 阿里巴巴集团控股有限公司 | The development and testing system of web page product, method of testing and device |
CN103488636B (en) * | 2012-06-11 | 2016-04-13 | 腾讯科技(深圳)有限公司 | A kind of method of browsing web pages in offline state and device |
CN104077389A (en) * | 2014-06-27 | 2014-10-01 | 北京奇虎科技有限公司 | Display method of webpage element information and browser device |
-
2014
- 2014-12-17 CN CN201410788334.XA patent/CN105760290B/en not_active Expired - Fee Related
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107784011A (en) * | 2016-08-30 | 2018-03-09 | 广州市动景计算机科技有限公司 | Web access method, client, web page server and programmable device |
CN108959057A (en) * | 2017-05-18 | 2018-12-07 | 腾讯科技(深圳)有限公司 | Test method, test device, storage equipment and the network equipment |
CN108959057B (en) * | 2017-05-18 | 2022-12-09 | 深圳市雅阅科技有限公司 | Test method, test device, storage equipment and network equipment |
CN107168881A (en) * | 2017-06-07 | 2017-09-15 | 成都四象联创科技有限公司 | Code positioning and processing method extremely |
CN108268332A (en) * | 2017-08-10 | 2018-07-10 | 广州神马移动信息科技有限公司 | Webpage abnormality monitoring method, equipment and system |
CN108038020A (en) * | 2018-01-02 | 2018-05-15 | 福建中金在线信息科技有限公司 | Webpage fault trace method, apparatus, electronic equipment and computer-readable storage medium |
CN111176871B (en) * | 2019-08-01 | 2022-02-08 | 腾讯科技(深圳)有限公司 | Target application processing method and device, storage medium and electronic device |
CN111176871A (en) * | 2019-08-01 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Target application processing method and device, storage medium and electronic device |
CN110955595A (en) * | 2019-11-13 | 2020-04-03 | 中信百信银行股份有限公司 | Problem repairing method and device, electronic equipment and computer readable storage medium |
CN110866212A (en) * | 2019-11-14 | 2020-03-06 | 北京无限光场科技有限公司 | Page abnormity positioning method and device, electronic equipment and computer readable medium |
CN111581063A (en) * | 2020-06-09 | 2020-08-25 | 北京大米未来科技有限公司 | Data processing method, readable storage medium and electronic device |
CN111930616A (en) * | 2020-07-27 | 2020-11-13 | 北京大米未来科技有限公司 | Data processing method and device, electronic equipment and readable storage medium |
CN111930616B (en) * | 2020-07-27 | 2024-03-19 | 北京大米未来科技有限公司 | Data processing methods, devices, electronic equipment and readable storage media |
CN113691405A (en) * | 2021-08-25 | 2021-11-23 | 北京知道创宇信息技术股份有限公司 | Access abnormity diagnosis method and device, storage medium and electronic equipment |
CN113691405B (en) * | 2021-08-25 | 2023-12-01 | 北京知道创宇信息技术股份有限公司 | Access abnormality diagnosis method and device, storage medium and electronic equipment |
CN114880612A (en) * | 2022-05-11 | 2022-08-09 | 网易有道信息技术(北京)有限公司 | Method for formula layout exception management and related product |
Also Published As
Publication number | Publication date |
---|---|
CN105760290B (en) | 2018-11-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105760290B (en) | The problem of being tested based on webpage front-end localization method and relevant apparatus, system | |
US10713149B2 (en) | Processing automation scripts of software | |
US20200249964A1 (en) | Automatic detection of user interface elements | |
JP5756386B2 (en) | Method, apparatus, and program for supporting generation and management of metadata for correcting problems of dynamic web application | |
US10621211B2 (en) | Language tag management on international data storage | |
US9880834B2 (en) | Source program analysis system, source program analysis method, and recording medium on which program is recorded | |
CN105335246B (en) | A kind of program crashing defect self-repairing method based on question and answer web analytics | |
US10261884B2 (en) | Method for correcting violation of source code and computer readable recording medium having program performing the same | |
US20230195825A1 (en) | Browser extension with automation testing support | |
WO2016073389A1 (en) | Event processing development environment | |
US20120166933A1 (en) | Verifying page layout automatically | |
US10324970B2 (en) | Feedback analysis for content improvement tasks | |
CN115658452B (en) | Buried point verification method, buried point verification device, readable storage medium, and electronic device | |
US8239362B1 (en) | Using metadata fragments as authoritative manufacturing work instructions | |
CN110908907A (en) | Web page testing method, device, equipment and storage medium | |
CN113051262B (en) | Data quality inspection method, device, equipment and storage medium | |
CN103593429B (en) | Commodity template failure detection method and device | |
CN111158973B (en) | A method for monitoring the dynamic evolution of web applications | |
US20220244975A1 (en) | Method and system for generating natural language content from recordings of actions performed to execute workflows in an application | |
US11740995B2 (en) | Source quality check service | |
KR20040009534A (en) | Method and system of testing web application | |
CN114548079B (en) | Text display method and device and readable storage medium | |
US20240012740A1 (en) | Systems and methods for integrated design, assessment and remediation of web pages | |
CN118502735A (en) | Editing auxiliary method and system for code editor and electronic equipment | |
CN115904934A (en) | Webpage testing method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20181113 |