大家好
我从事
政府招标的
自动化 。
这个故事的发生是由于节省。 当购买付费帐户Kontur。Purchasing时,我们没有注意专家级费率有多大用处。
嗯,如果我们注意这一点,那么我就不必学习Selenium和Java基础知识。
一旦出现营销挑战-就我们的主题收集公司中买家的联系方式。
我正在寻找所有在正确区域内匹配关键字的比赛。 在过去的几年中,已完成且正在进行中。
在以标准费率卸载时,以下数据:

只有公司名称。 没有买家的联系信息。
现在,为了不手动收集买家的联系方式,我决定编写一个脚本。
由于Kontur.Purchase的整个页面都加载了javascript,因此您无法摆脱简单的解析。 您必须使用Selenium编写脚本。
首先,准备初始数据-将竞赛编号保存为CSV(也是URL中的参数)以及公司名称,以免对其进行解析。 所有这些都在kontur_getContacts_src.csv文件中

接下来,带有注释的Java脚本
import org.openqa.selenium.By; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.*; import org.openqa.selenium.firefox.*; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import java.util.List; import java.util.concurrent.TimeUnit; import java.io.*; import java.nio.file.*; public class kontur_getContacts{ public static void main(String args[]) throws Exception{
运行Selenium脚本
C:\Users\user\selenium>"C:\Program Files\Java\jdk-10.0.1\bin\javac" -cp selenium-server-standalone-3.13.0.jar; kontur_getContacts.java
* C:\Users\user\selenium>"C:\Program Files\Java\jre-10.0.1\bin\java" -cp selenium-server-standalone-3.13.0.jar; kontur_getContacts
结果是一个联系人文件,您可以将其用于营销目的。
