在XPath中使用参数

时间:2016-09-28 20:14:38

标签: python selenium xpath

我正在尝试在xpath表达式中使用参数,但没有运气。

SELECT * FROM Offer_Interest oi
INNER JOIN Offer o ON oi.Offer_ID_SQL = o.Offer_ID_SQL
INNER JOIN OPENQUERY([TR-SF-PROD], 'SELECT Id, OFFER_ID_SQL__C FROM Offer__c') osf ON o.Offer_ID_SQL =osf.OFFER_ID_SQL__C
INNER JOIN Interest i ON oi.Interest_ID_SQL = i.Interest_ID_SQL
INNER JOIN OPENQUERY([TR-SF-PROD], 'SELECT INTEREST_ID_SQL__C, Id FROM Interest__c') isf ON i.Interest_ID_SQL =isf.Interest_ID_SQL__c
WHERE o.PrimaryContact_ID_SQL = 2803

我做错了什么?

1 个答案:

答案 0 :(得分:3)

不要忘记占位符周围的引号:

"//*[@id='%s']/optgroup[@label='%s']/[contains(@title, '%s')]" % (FIELDTYPE, label, fieldtype)

另请注意,我还在*之后添加了//