我需要能够基于字符串值及其标识符值聚合字符串和另一个单元格的值。
我尝试了几种将值求和,按特定项目过滤的方法,然后尝试根据包含的文本求和,但没有找到好的方法。
Then(/^the user clicks on "(.*)" download on "(.*)" page$/) do |field_name, page_name|
# get the XPATH or CSS from page object file, Raises Error if not found
begin
selector, element_path = get_element_target(field_name, page_name).split('^^')
rescue
fail("Element Xpath is not found for #{field_name} in #{page_name} page objects File")
end
if selector.nil? || element_path.nil?
fail("Element Xpath is not found for #{field_name} in #{page_name} page objects File")
end
selector = (selector.downcase.include? 'xpath') ? :xpath : :css
# Create the Element object
element_obj = @browser.element(selector, element_path)
# Wait for element to be present
wait_for_element(element_obj)
# Focus on element to make it visible
focus_on_element(element_obj)
DOWNLOAD_DIR = "#{Dir.pwd}" + '/features/support/Downloads/'
element_obj.click(DOWNLOAD_DIR)
end
我不确定如何对sum(A)和sum(B)进行处理,其中A包含相同的文本,但不包括标识符。
当前,我正在执行查询以仅从较大的数据集中获取A和B,然后执行$ ldd /usr/bin/gdb | grep python
libpython3.7m.so.1.0 => /lib64/libpython3.7m.so.1.0 (0x00007f39f9c37000)
来删除所有╔══════════════╦═════════════════╗
║ A ║ B ║
╠══════════════╬═════════════════╣
║ Product Name ║ Product Quantity║
╠══════════════╬═════════════════╣
║ ProductA - 1 ║ 12 ║
╠══════════════╬═════════════════╣
║ ProductA - 2 ║ 2 ║
╠══════════════╬═════════════════╣
║ ProductB - 1 ║ 28 ║
╠══════════════╬═════════════════╣
║ ProductB - 2 ║ 21 ║
╠══════════════╬═════════════════╣
║ ProductC - 1 ║ 1 ║
╠══════════════╬═════════════════╣
║ ProductC - 2 ║ 4 ║
╠══════════════╬═════════════════╣
║ ProductD - 1 ║ 98 ║
╠══════════════╬═════════════════╣
║ ProductD - 2 ║ 75 ║
╠══════════════╬═════════════════╣
║ ProductE - 1 ║ 5 ║
╠══════════════╬═════════════════╣
║ ProductE - 2 ║ 9 ║
╚══════════════╩═════════════════╝
和Find and Replace
,然后进行
- 1