我正在Wordpress中创建一个预订表单,它将数据发送到外部CRM(在这种情况下是飞艇),同时还将数据存储在Wordpress CMS中,然后可以自动通过电子邮件发送。
目前我已尝试过联系表单7和其他一些插件,但这需要自己的action="/?page_id=1327&preview=true#wpcf7-f1326-p1327-o1"
(就像构建时的页面预览一样)。
飞艇CRM还拥有提交数据所需的action="http://atwbar.com/linkitajax.php"
。
任何建议/建议都 HUGELY 赞赏!
答案 0 :(得分:1)
当我想保存一些特殊数据,将表单处理为crm或只是重定向所有表单时,我使用Contact表单7挂钩:package TestNG;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
public class GoogleAccountLogin {
WebDriver driver;
@BeforeTest
public void setUp() {
System.setProperty("webdriver.gecko.driver","F:\\path\\geckodriver.exe");
driver=new FirefoxDriver();
}
@Test(priority=0)
public void LoginSuccessful() throws InterruptedException {
// Go to google account
driver.manage().window().maximize();
driver.get("https://accounts.google.com");
Thread.sleep(3000);
// Check if the page is correct
String currentTitle = driver.getTitle();
Assert.assertEquals(currentTitle, "Sign in - Google Accounts");
// Enter email and submit
WebElement email = driver.findElement(By.id("Email"));
email.clear();
email.sendKeys("validemail");
WebElement Next = driver.findElement(By.id("next"));
Next.click();
Thread.sleep(1000);
// Enter password
WebElement password = driver.findElement(By.id("Passwd"));
password.clear();
password.sendKeys("validpassword");
WebElement Login = driver.findElement(By.id("signIn"));
Login.click();
Thread.sleep(5000);
// Check if login successful
currentTitle = driver.getTitle();
Assert.assertEquals(currentTitle, "My Account");
}
@Test(priority=1)
public void LoginFailInvalidEmail() throws InterruptedException {
// Go to google account
driver.manage().window().maximize();
driver.get("https://accounts.google.com");
Thread.sleep(3000);
// Check if the page is correct
String currentTitle = driver.getTitle();
Assert.assertEquals(currentTitle, "Sign in - Google Accounts");
// Enter email and submit
WebElement email = driver.findElement(By.id("Email"));
email.clear();
email.sendKeys("falseemail");
WebElement Next = driver.findElement(By.id("next"));
Next.click();
Thread.sleep(1000);
// Check error message and login state
String errorMess = driver.findElement(By.id("errormsg_0_Email")).getText();
Assert.assertEquals(errorMess, "Sorry, Google doesn't recognize that email.");
currentTitle = driver.getTitle();
Assert.assertEquals(currentTitle, "Sign in - Google Accounts");
}
@AfterTest
public void tearDown() {
driver.close();
driver.quit();
}
}
这是一个将任何表单重定向到页面的示例(从我已经完成的实用程序插件中提取,因此,不要关注未设置和会话行,选项......)。
wpcf7_before_send_mail
要保存表单字段,只需使用update_post_meta。
还有其他方法可以在wp_ajax_no_priv _ {$ action} action和js上发送请求。
告诉我它是否对您有所帮助,或者您是否需要更多提示!