官术网_书友最值得收藏!

The phantom object

The phantom object is your reference to PhantomJS within your scripts that allows you to access certain properties and provides functionality that affects the entire script (such as quitting the application as previously mentioned.) The phantom object can be directly referenced anywhere in the script and does not need to be explicitly imported. You may also access it as a child of the global window object.

The phantom object allows access to relevant data, such as cookies and library paths. If we want to import or inject third-party JavaScript libraries, such as jQuery, we can do that using the phantom object. We can also create a "catch all" event handler for errors using the onError event of the phantom object.

PhantomJS not only allows us to harness the power of JavaScript but also gives us a very useful API. Each day, more and more contributors are enhancing this API, giving us more options and easier ways to solve real problems. We will learn more about these APIs as we continue our journey learning about PhantomJS.

主站蜘蛛池模板: 龙岩市| 常德市| 临洮县| 淳安县| 高邑县| 牟定县| 贡嘎县| 西丰县| 英超| 定州市| 广宁县| 乐东| 长葛市| 精河县| 肥东县| 双城市| 泗洪县| 金昌市| 扎囊县| 武定县| 溧水县| 沛县| 临沂市| 龙泉市| 香格里拉县| 达日县| 永嘉县| 昭平县| 永康市| 永寿县| 沈丘县| 苗栗县| 临沂市| 从江县| 奈曼旗| 乌审旗| 南宫市| 新郑市| 北海市| 广丰县| 双鸭山市|