The strategy sounds like free money and is not. The stock is marked down by roughly the dividend on the ex-dividend-date, so the captured cash is offset by an equivalent capital loss. What is left is the residual price drift, minus commissions, spread, and tax.
Tax makes it worse in most jurisdictions. Holding periods for a qualified-dividend are typically 61 days around the ex-date, so a two-day hold is taxed at ordinary income rates while the offsetting loss may be a capital loss.
Example: buy 2,000 shares at $50 and collect $1.00 per share, or $2,000. The stock opens at $49. You sell at $49 for a $2,000 capital loss, pay tax on $2,000 of unqualified income, and are left worse off by the spread and the tax.
Related: ex-dividend-date, ex-dividend-price-adjustment, qualified-dividend, wash-sale-rule